LP#1339190 multiple port probs (time::hires); logging
authorBill Erickson <berick@esilibrary.com>
Mon, 18 Aug 2014 20:35:50 +0000 (16:35 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 18 Aug 2014 20:35:50 +0000 (16:35 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
SIPServer.pm

index b5e5b34..e61a7b8 100755 (executable)
@@ -42,6 +42,7 @@ use Sip::Constants qw(:all);
 use Sip::Configuration;
 use Sip::Checksum qw(checksum verify_cksum);
 use Sip::MsgType;
+use Time::HiRes qw/time/;
 
 use Cache::Memcached;
 
@@ -296,6 +297,9 @@ sub mux_input {
     my $conn_id = $mself->{conn_id};
     if (!$conn_id) {
         $mself->{conn_id} = $conn_id = "$peeraddr:$peerport\@" . time();
+        syslog('LOG_DEBUG', "Created new connection: $conn_id");
+    } else {
+        syslog('LOG_DEBUG', "Inbound msg on existing connection: $conn_id");
     }
 
     # check for kids that went away
@@ -305,7 +309,7 @@ sub mux_input {
     check_pending_connections();
 
     my $c = scalar(keys %active_connections);
-    syslog("LOG_DEBUG", "multi: inbound message on connection; $c total");
+    syslog("LOG_DEBUG", "multi: inbound message on connection $conn_id; $c total");
 
     if ($kid_count >= $max_concurrent) {
         # XXX should we say something to the client? maybe wait and try again?
@@ -383,18 +387,14 @@ sub mux_input {
 
                     $self->{state} = $self->{ils}->state() if (UNIVERSAL::can($self->{ils},'state'));
 
-                    # Evergreen, at least, needs a chance to clean up before forking for other requests
-                    # Note: This should not be necessary, w/ the child process exiting on completion
-                    #$self->{ils}->disconnect() if (UNIVERSAL::can($self->{ils},'disconnect'));
-
-                    # Stash the ILS module somewhere handy for later
-                    my $ils_ref = ref($self->{ils});
-
                     $cache_data->{success} = 1;
                     $cache_data->{net_server_parts} = {
                         map { ($_ => $$self{$_}) } qw/state institution account/
                     };
-                    $cache_data->{net_server_parts}{ils} = $ils_ref;
+
+                    # Stash the ILS module somewhere handy for later
+                    $cache_data->{net_server_parts}{ils} = ref($self->{ils});
+
                 } else {
                     $cache_data->{success} = 0;
                 }
@@ -447,6 +447,7 @@ sub mux_input {
 
         } else { # waited too long, kid and pipe are gone
             $active_connections{$conn_id}{worker_pipe} = IO::Pipe->new;
+            syslog('LOG_DEBUG', "multi: parent creating new pipe for existing connection");
     
             my $pid = fork();
             if (!defined($pid) or $pid < 0) {