Net::Server::Coro3pm
A co-operative multithreaded server using coro
Usage
use Coro;use base qw/Net::Server::Coro/;__PACKAGE__->new->run;sub process_request {...cede;...}
Overview
Net::Server::Coro implements multithreaded server for the Net::Server architecture, using Coro and Coro::Socket to make all reads and writes non-blocking. Additionally, it supports non-blocking SSL negotiation.
Methods
Most methods are inherited from Net::Server -- see it for further usage details.
new
Create new Net::Server::Coro object. It accepts these parameters (in addition to Net::Server parameters):
- server_cert
-
Path to the SSL certificate that the server should use. This can be either relative or absolute path. Defaults to certs/server-cert.pem
- server_key
-
Path to the SSL certificate key that the server should use. This can be either relative or absolute path. Defaults to certs/server-key.pem
proto_object HOST, PORT, PROTO
Wraps socket creation, turning all socket types into Net::Server::Proto::Coro objects.
loop
The main loop uses starts a number of Coro coroutines:
- •
-
One for each listening socket.
- •
-
One for each active connection. Since these may respawn on a firlay frequent basis, "async_pool" in Coro is used to maintain a pool of coroutines.
- •
-
An AnyEvent infinite wait, which equates to the "run the event loop."
server_cert [PATH]
Gets or sets the path of the SSL certificate used by the server.
server_key [PATH]
Gets or sets the path of the SSL key file used by the server.
Dependencies
Coro, AnyEvent, Net::Server
Bugs and limitations
The client filehandle, socket, and peer information all use Coro::Specific in order to constrain their information to their coroutine. Attempting to access them from a different coroutine will yield possibly unexpected results.
Generally, all those of Coro. Please report any bugs or feature requests specific to Net::Server::Coro to "[email protected]", or through the web interface at <http://rt.cpan.org>.
Releases
6 releases since Debian 8 (Jessie); the text changed 1 time.