[Bps-public-commit] r9953 - in Net-Server-Coro: .

alexmv at bestpractical.com alexmv at bestpractical.com
Fri Dec 14 15:29:24 EST 2007


Author: alexmv
Date: Fri Dec 14 15:29:14 2007
New Revision: 9953

Modified:
   Net-Server-Coro/   (props changed)
   Net-Server-Coro/lib/Net/Server/Coro.pm

Log:
 r25771 at zoq-fot-pik:  chmrr | 2007-12-14 15:28:52 -0500
  * Add a high priority event loop


Modified: Net-Server-Coro/lib/Net/Server/Coro.pm
==============================================================================
--- Net-Server-Coro/lib/Net/Server/Coro.pm	(original)
+++ Net-Server-Coro/lib/Net/Server/Coro.pm	Fri Dec 14 15:29:14 2007
@@ -54,7 +54,6 @@
         my $fh   = pop @FH;
         if ($fh) {
             $prop->{connected} = 1;
-            my $from = $fh->peername;
             $prop->{client} = $fh;
             $SELF->run_client_connection;
             last if $SELF->done;
@@ -73,6 +72,17 @@
 sub loop {
     my $self = $SELF = shift;
     my $prop = $self->{server};
+
+    async {
+        # We want this to be higher priority so it gets timeslices
+        # when other things cede; this guarantees that we notice
+        # socket activity and deal.
+        $Coro::current->prio(3);
+        while () {
+            EV::loop();
+        }
+    };
+
     for my $socket ( @{ $prop->{sock} } ) {
         async {
             while (1) {



More information about the Bps-public-commit mailing list