From: Matt S Trout Date: Thu, 1 Dec 2011 22:54:09 +0000 (+0000) Subject: cleanup connection setup X-Git-Tag: v0.001001~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6518a48007b56194d5f14d8f66762cabda795bca;p=scpubgit%2FTak-Daemon.git cleanup connection setup --- diff --git a/lib/Tak/Daemon/ListenerService.pm b/lib/Tak/Daemon/ListenerService.pm index f9738ce..95c0499 100644 --- a/lib/Tak/Daemon/ListenerService.pm +++ b/lib/Tak/Daemon/ListenerService.pm @@ -87,13 +87,15 @@ sub DEMOLISH { sub setup_connection { my ($self, $socket) = @_; my $conn_set = $self->connections; - my $connection; - $connection = Tak::ConnectionService->new( + my $conn_str; + my $connection = Tak::ConnectionService->new( read_fh => $socket, write_fh => $socket, - listening_service => $self->router->clone, - on_close => sub { delete $conn_set->{$connection} } + listening_service => $self->router->clone_or_self, + on_close => sub { delete $conn_set->{$conn_str} } ); - $conn_set->{$connection} = $connection; + $conn_str = "$connection"; + $connection->receiver->service->service->register_weak(remote => $connection); + $conn_set->{$conn_str} = $connection; return; }