flush the xmpp socket before attempting to process new marc stream requests
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Jul 2010 21:16:00 +0000 (21:16 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Jul 2010 21:16:00 +0000 (21:16 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16991 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 99a80fc..f04b824 100755 (executable)
@@ -31,6 +31,7 @@ use OpenSRF::Utils::Logger qw/$logger/;
 use OpenSRF::AppSession;
 use OpenSRF::EX qw/:try/;
 use OpenILS::Utils::Cronscript;
+use OpenSRF::Transport::PeerHandle;
 require 'oils_header.pl';
 use vars qw/$apputils/;
 
@@ -347,6 +348,13 @@ sub process_request {   # The core Net::Server method
 
     $logger->info("stream parser received contact from $client");
 
+    my $ph = OpenSRF::Transport::PeerHandle->retrieve;
+    if(!$ph->flush_socket()) {
+        $logger->error("We received a request, bu we are no longer connected to opensrf.  ".
+            "Exiting and dropping request from $client");
+        exit;
+    }
+
     my $data;
     eval {
         local $SIG{ALRM} = sub { die "alarm\n" };