From c3670c4bf31a137f95abe5fedde7e372f4ecfd15 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 27 Feb 2019 11:15:07 +0100 Subject: [PATCH] Disconnect only after the identify answer (#977) --- protocols/identify/src/periodic_id_handler.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocols/identify/src/periodic_id_handler.rs b/protocols/identify/src/periodic_id_handler.rs index 4f175600..9dd8cccc 100644 --- a/protocols/identify/src/periodic_id_handler.rs +++ b/protocols/identify/src/periodic_id_handler.rs @@ -105,7 +105,8 @@ where protocol: >::Output, _info: Self::OutboundOpenInfo, ) { - self.pending_result = Some(PeriodicIdHandlerEvent::Identified(protocol)) + self.pending_result = Some(PeriodicIdHandlerEvent::Identified(protocol)); + self.first_id_happened = true; } #[inline] @@ -117,6 +118,7 @@ where #[inline] fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, err: ProtocolsHandlerUpgrErr<>::Error>) { self.pending_result = Some(PeriodicIdHandlerEvent::IdentificationError(err)); + self.first_id_happened = true; if let Some(ref mut next_id) = self.next_id { next_id.reset(Instant::now() + TRY_AGAIN_ON_ERR); } @@ -164,7 +166,6 @@ where next_id.reset(Instant::now() + DELAY_TO_NEXT_ID); let upgrade = self.config.clone(); let ev = ProtocolsHandlerEvent::OutboundSubstreamRequest { upgrade, info: () }; - self.first_id_happened = true; Ok(Async::Ready(ev)) } }