From 00bf1bebe3d7ad2bc0bf6e066a44b60b7df9b541 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 24 Jul 2009 21:00:01 +0000 Subject: [PATCH] reset the alarm with each socket read so that we only time out after a period of inactivity 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/support-scripts/marc_stream_importer.pl b/Open-ILS/src/support-scripts/marc_stream_importer.pl index c15efcc312..ceb6cd5740 100644 --- a/Open-ILS/src/support-scripts/marc_stream_importer.pl +++ b/Open-ILS/src/support-scripts/marc_stream_importer.pl @@ -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; }; -- 2.11.0