mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-26 03:12:12 +00:00
Disconnect only after the identify answer (#977)
This commit is contained in:
parent
56a027cd32
commit
c3670c4bf3
@ -105,7 +105,8 @@ where
|
|||||||
protocol: <Self::OutboundProtocol as OutboundUpgrade<TSubstream>>::Output,
|
protocol: <Self::OutboundProtocol as OutboundUpgrade<TSubstream>>::Output,
|
||||||
_info: Self::OutboundOpenInfo,
|
_info: Self::OutboundOpenInfo,
|
||||||
) {
|
) {
|
||||||
self.pending_result = Some(PeriodicIdHandlerEvent::Identified(protocol))
|
self.pending_result = Some(PeriodicIdHandlerEvent::Identified(protocol));
|
||||||
|
self.first_id_happened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -117,6 +118,7 @@ where
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, err: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>) {
|
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, err: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>) {
|
||||||
self.pending_result = Some(PeriodicIdHandlerEvent::IdentificationError(err));
|
self.pending_result = Some(PeriodicIdHandlerEvent::IdentificationError(err));
|
||||||
|
self.first_id_happened = true;
|
||||||
if let Some(ref mut next_id) = self.next_id {
|
if let Some(ref mut next_id) = self.next_id {
|
||||||
next_id.reset(Instant::now() + TRY_AGAIN_ON_ERR);
|
next_id.reset(Instant::now() + TRY_AGAIN_ON_ERR);
|
||||||
}
|
}
|
||||||
@ -164,7 +166,6 @@ where
|
|||||||
next_id.reset(Instant::now() + DELAY_TO_NEXT_ID);
|
next_id.reset(Instant::now() + DELAY_TO_NEXT_ID);
|
||||||
let upgrade = self.config.clone();
|
let upgrade = self.config.clone();
|
||||||
let ev = ProtocolsHandlerEvent::OutboundSubstreamRequest { upgrade, info: () };
|
let ev = ProtocolsHandlerEvent::OutboundSubstreamRequest { upgrade, info: () };
|
||||||
self.first_id_happened = true;
|
|
||||||
Ok(Async::Ready(ev))
|
Ok(Async::Ready(ev))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user