… | |
… | |
58 | push @{$self->{queue}}, shift; |
58 | push @{$self->{queue}}, shift; |
59 | $self->connect; |
59 | $self->connect; |
60 | }; |
60 | }; |
61 | } |
61 | } |
62 | |
62 | |
63 | # called only after successful handshake |
63 | # called each time we fail to establish a connection, |
|
|
64 | # or the existing connection failed |
64 | sub transport_error { |
65 | sub transport_error { |
65 | my ($self, @reason) = @_; |
66 | my ($self, @reason) = @_; |
66 | |
67 | |
67 | my $no_transport = !$self->{transport}; |
68 | my $no_transport = !$self->{transport}; |
68 | |
69 | |
… | |
… | |
76 | $_->(@reason) for map @$_, values %$mon; |
77 | $_->(@reason) for map @$_, values %$mon; |
77 | } |
78 | } |
78 | |
79 | |
79 | AnyEvent::MP::Kernel::_inject_nodeevent ($self, 0, @reason) |
80 | AnyEvent::MP::Kernel::_inject_nodeevent ($self, 0, @reason) |
80 | unless $no_transport; |
81 | unless $no_transport; |
|
|
82 | |
|
|
83 | # if we are here and are idle, we nuke ourselves |
|
|
84 | delete $AnyEvent::MP::Kernel::NODE{$self->{id}} |
|
|
85 | unless $self->{transport} || $self->{connect_to}; |
81 | } |
86 | } |
82 | |
87 | |
83 | # called after handshake was successful |
88 | # called after handshake was successful |
84 | sub transport_connect { |
89 | sub transport_connect { |
85 | my ($self, $transport) = @_; |
90 | my ($self, $transport) = @_; |