logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Net::Server::Coro - A co-operative multithreaded server using Coro

Authors

       Alex Vandiver "<alexmv@bestpractical.com>"; code originally from Audrey Tang "<cpan@audreyt.org>"

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 "bug-net-server-coro@rt.cpan.org", or through the web interface at <http://rt.cpan.org>.

Dependencies

       Coro, AnyEvent, Net::Server

Description

       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.pemproto_objectHOST,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.

Name

       Net::Server::Coro - A co-operative multithreaded server using Coro

Synopsis

           use Coro;
           use base qw/Net::Server::Coro/;

           __PACKAGE__->new->run;

           sub process_request {
              ...
              cede;
              ...
           }

See Also