LP#1339190 Log and exit gracefully ILS re-init failure in mux handler
authorBill Erickson <berick@esilibrary.com>
Tue, 8 Oct 2013 17:37:54 +0000 (13:37 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 8 Aug 2014 14:23:17 +0000 (10:23 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
SIPServer.pm

index 495cb98..7b0e1a2 100644 (file)
@@ -170,7 +170,7 @@ sub process_request {
 # Multiplex.
 
 my %kid_hash;
-my $kid_count;
+my $kid_count = 0;
 
 sub REAPER {
   for (keys(%kid_hash)) {
@@ -275,6 +275,11 @@ sub mux_input {
         # build the connection we deleted after logging in
         $self->{ils} = $active_connections{$conn_id}->{ils}->new($self->{institution}, $self->{account});
 
+        if (!$self->{ils}) {
+            syslog('LOG_ERR', "Unable to build ILS module in mux child");
+            exit(0);
+        }
+
         # build the connection we deleted after logging in
         my $input = Sip::read_SIP_packet($str_fh);
         $input =~ s/[\r\n]+$//sm;    # Strip off any trailing line ends
@@ -299,7 +304,7 @@ sub mux_input {
 sub mux_close {
     my ($self, $mux, $fh) = @_;
     delete $active_connections{''.$fh};
-    syslog("LOG_DEBUG", "multi: cleaning up child: $fh; ". 
+    syslog("LOG_DEBUG", "multi: mux_close cleaning up child: $fh; ". 
         scalar(keys %active_connections)." remain");
 }