[interchange-cvs] interchange - kwalsh modified lib/Vend/Server.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Feb 4 16:42:19 EST 2008


User:      kwalsh
Date:      2008-02-04 21:42:19 GMT
Modified:  lib/Vend Server.pm
Log:
    * Changes in the _read() subroutine:

	-- select() returns -1 upon error, whereas sysread() returns undef,
	   so we need to allow for both.

	-- Catch EAGAIN as well as EINTR as soft errors to retry on.

	-- Read the entire available amount of data in one hit instead of
	   forcing the data to be read in 512-byte chunks.

Revision  Changes    Path
2.86      +5 -4      interchange/lib/Vend/Server.pm


rev 2.86, prev_rev 2.85
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.85
retrieving revision 2.86
diff -u -r2.85 -r2.86
--- Server.pm	2 Jan 2008 15:33:49 -0000	2.85
+++ Server.pm	4 Feb 2008 21:42:18 -0000	2.86
@@ -1,6 +1,6 @@
 # Vend::Server - Listen for Interchange CGI requests as a background server
 #
-# $Id: Server.pm,v 2.85 2008/01/02 15:33:49 racke Exp $
+# $Id: Server.pm,v 2.86 2008/02/04 21:42:18 kwalsh Exp $
 #
 # Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -26,7 +26,7 @@
 package Vend::Server;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.85 $, 10);
+$VERSION = substr(q$Revision: 2.86 $, 10);
 
 use Cwd;
 use POSIX qw(setsid strftime);
@@ -655,9 +655,10 @@
 
     do {
 	if (($r = select($rin, undef, undef, 1)) > 0) {
-	    $r = sysread($fh, $$in, 512, length($$in));
+	    $r = sysread($fh, $$in, $r, length($$in));
 	}
-    } while (!defined $r and $!{eintr});
+    } while ((!defined($r) || $r == -1) && ($!{eintr} || $!{eagain}));
+
     die "read: $!" unless defined $r;
     die "read: closed" unless $r > 0;
 }








More information about the interchange-cvs mailing list