reset the alarm with each socket read so that we only time out after a period of...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 24 Jul 2009 21:00:01 +0000 (21:00 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 24 Jul 2009 21:00:01 +0000 (21:00 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13740 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/marc_stream_importer.pl

index c15efcc..ceb6cd5 100644 (file)
@@ -82,10 +82,11 @@ sub process_request {
     # and pull the data directly from the socket
     eval {
         local $SIG{ALRM} = sub { die "alarm\n" }; 
-        alarm $wait_time;
-        while(my $n = $socket->sysread($buf, $bufsize)) {
+        do {
+            alarm $wait_time;
+            last unless $socket->sysread($buf, $bufsize);
             $data .= $buf;
-        }
+        } while(1);
         alarm 0;
     };