Make the connection references weak references.
This commit is contained in:
@@ -7,6 +7,7 @@ package AnyEvent::NSQ::Reader;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Carp 'croak';
|
use Carp 'croak';
|
||||||
|
use Scalar::Util qw( weaken );
|
||||||
|
|
||||||
use parent 'AnyEvent::NSQ::Client';
|
use parent 'AnyEvent::NSQ::Client';
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@ sub _identified {
|
|||||||
## Keep the connection in the registry in case the user
|
## Keep the connection in the registry in case the user
|
||||||
## wants to issue FIN/REQs inside the callback
|
## wants to issue FIN/REQs inside the callback
|
||||||
$self->{routing}->{$msg->{message_id}} = $conn;
|
$self->{routing}->{$msg->{message_id}} = $conn;
|
||||||
|
weaken( $self->{routing}->{$msg->{message_id}} );
|
||||||
|
|
||||||
my $action = $self->{message_cb}->($self, $msg);
|
my $action = $self->{message_cb}->($self, $msg);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user