[Opensrf-commits] r1729 - trunk/src/perl/lib/OpenSRF/Transport/SlimJabber (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 28 16:27:47 EDT 2009


Author: erickson
Date: 2009-07-28 16:27:42 -0400 (Tue, 28 Jul 2009)
New Revision: 1729

Modified:
   trunk/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm
Log:
reduce unnecessary calls to fcntl() while reading from the socket

Modified: trunk/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm
===================================================================
--- trunk/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm	2009-07-28 13:31:35 UTC (rev 1728)
+++ trunk/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm	2009-07-28 20:27:42 UTC (rev 1729)
@@ -208,13 +208,15 @@
     # now slurp the data off the socket
     my $buf;
     my $read_size = 1024;
+    my $nonblock = 0;
     while(my $n = sysread($socket, $buf, $read_size)) {
         $self->{parser}->parse_more($buf) if $buf;
         if($n < $read_size or $self->peek_msg) {
-            set_block($socket);
+            set_block($socket) if $nonblock;
             last;
         }
-        set_nonblock($socket);
+        set_nonblock($socket) unless $nonblock;
+        $nonblock = 1;
     }
 
     return $self->next_msg;



More information about the opensrf-commits mailing list