From 8830706579893b4547d212f4a07d32ab4543b660 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 25 Jul 2014 17:13:46 -0400 Subject: [PATCH] do not freeze complex objects, and use FreezeThaw instead of Storable Signed-off-by: Mike Rylander --- SIPServer.pm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/SIPServer.pm b/SIPServer.pm index 272e27d..4b6c77c 100644 --- a/SIPServer.pm +++ b/SIPServer.pm @@ -42,7 +42,7 @@ use Sip::Checksum qw(checksum verify_cksum); use Sip::MsgType; use File::Queue; -use Storable qw(freeze thaw); +use FreezeThaw qw(freeze thaw); my $mp_fifo = File::Queue->new( File => "/tmp/SIPServer.mulitplex-fifo.$$" ); END { $mp_fifo->delete }; @@ -192,7 +192,7 @@ sub REAPER { my %active_connections; sub PERMAFROST { while (my $login = $mp_fifo->deq) { - $login = thaw($login); + ($login) = thaw($login); my $c = $$login{id}; if ($$login{success}) { @@ -201,13 +201,10 @@ sub PERMAFROST { $active_connections{$c}{id} = $$login{id}; $active_connections{$c}{transport} = $$login{transport}; - $active_connections{$c}{net_server} = bless( - { # Last wins - %{ $active_connections{$c}{net_server} }, - %{ $$login{net_server_parts} } - }, - ref($active_connections{$c}{net_server}) - ); + for my $p (keys %{ $$login{net_server_parts} }) { + $active_connections{$c}{net_server}{$p} = + $$login{net_server_parts}{$p}; + } } else { delete $active_connections{$c}; } @@ -274,7 +271,7 @@ sub mux_input { } # We stick this here, assuming success. Cleanup comes later via PERMAFROST(). - $active_connections{$conn_id} = { id => $conn_id, transport => $transport }; + $active_connections{$conn_id} = { id => $conn_id, transport => $transport, net_server => $self }; my $pid = fork(); if (!defined($pid) or $pid < 0) { @@ -307,7 +304,7 @@ sub mux_input { success => $success, transport => $transport, net_server_parts => { - %$self{ wq/service ils state institution account/ } + %$self{ qw/ils state institution account/ } } }) ); -- 2.11.0