… | |
… | |
92 | delete $self->{trial}; |
92 | delete $self->{trial}; |
93 | |
93 | |
94 | $self->transport_error (transport_error => "switched connections") |
94 | $self->transport_error (transport_error => "switched connections") |
95 | if $self->{transport}; |
95 | if $self->{transport}; |
96 | |
96 | |
|
|
97 | delete $self->{connect_addr}; |
97 | delete $self->{connect_w}; |
98 | delete $self->{connect_w}; |
98 | delete $self->{connect_to}; |
99 | delete $self->{connect_to}; |
99 | |
100 | |
100 | $self->{transport} = $transport; |
101 | $self->{transport} = $transport; |
101 | |
102 | |
… | |
… | |
123 | $self->{connect_to} ||= AE::timer $monitor, 0, sub { |
124 | $self->{connect_to} ||= AE::timer $monitor, 0, sub { |
124 | $self->transport_error (transport_error => $self->{id}, "unable to connect"); |
125 | $self->transport_error (transport_error => $self->{id}, "unable to connect"); |
125 | }; |
126 | }; |
126 | |
127 | |
127 | return unless @addresses; |
128 | return unless @addresses; |
|
|
129 | |
128 | return if $self->{connect_w}; |
130 | if ($self->{connect_w}) { |
|
|
131 | # sometimes we get told about new addresses after we started to connect |
|
|
132 | unshift @{$self->{connect_addr}}, @addresses; |
|
|
133 | return; |
|
|
134 | } |
|
|
135 | |
|
|
136 | $self->{connect_addr} = \@addresses; # a bit weird, but efficient |
129 | |
137 | |
130 | $AnyEvent::MP::Kernel::WARN->(9, "connecting to $self->{id} with [@addresses]"); |
138 | $AnyEvent::MP::Kernel::WARN->(9, "connecting to $self->{id} with [@addresses]"); |
131 | |
139 | |
132 | my $interval = $AnyEvent::MP::Kernel::CONFIG->{connect_interval}; |
140 | my $interval = $AnyEvent::MP::Kernel::CONFIG->{connect_interval}; |
133 | |
141 | |