Allow the ILS to save state in IO::Multiplex mode
authorMike Rylander <mrylander@gmail.com>
Wed, 9 Oct 2013 15:34:23 +0000 (11:34 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 8 Aug 2014 14:08:36 +0000 (10:08 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
SIPServer.pm

index 7b0e1a2..669f6fd 100644 (file)
@@ -254,6 +254,10 @@ sub mux_input {
 
         # Stash the ILS module somewhere handy for later
         $active_connections{$conn_id}->{ils} = ref($self->{ils});
+
+        # And, if the ILS module wants to save some state, allow that
+        $active_connections{$conn_id}->{state} = $self->{ils}->state() if (UNIVERSAL::can($self->{ils},'state'));;
+
         delete $$self{ils};
 
         my $c = scalar(keys %active_connections);
@@ -273,7 +277,7 @@ sub mux_input {
     if ($pid == 0) { # in kid
 
         # build the connection we deleted after logging in
-        $self->{ils} = $active_connections{$conn_id}->{ils}->new($self->{institution}, $self->{account});
+        $self->{ils} = $active_connections{$conn_id}->{ils}->new($self->{institution}, $self->{account}, $active_connections{$conn_id}->{state});
 
         if (!$self->{ils}) {
             syslog('LOG_ERR', "Unable to build ILS module in mux child");