More precise error passed to inject_dial_upgrade_error (#771)

* More precise error passed to inject_dial_upgrade_error

* Fix concerns

* Fix panic proof
This commit is contained in:
Pierre Krieger
2018-12-18 11:23:13 +01:00
committed by GitHub
parent af698a1ce7
commit 83320e0347
14 changed files with 194 additions and 52 deletions

View File

@@ -24,6 +24,7 @@ use libp2p_core::{
OutboundUpgrade,
ProtocolsHandler,
ProtocolsHandlerEvent,
protocols_handler::ProtocolsHandlerUpgrErr,
upgrade::DeniedUpgrade
};
use log::warn;
@@ -183,7 +184,7 @@ where
fn inject_inbound_closed(&mut self) {}
#[inline]
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, _: io::Error) {
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, _: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>) {
// In case of error while upgrading, there's not much we can do except shut down.
// TODO: we assume that the error is about ping not being supported, which is not
// necessarily the case

View File

@@ -23,8 +23,10 @@ use arrayvec::ArrayVec;
use futures::prelude::*;
use libp2p_core::{
InboundUpgrade,
OutboundUpgrade,
ProtocolsHandler,
ProtocolsHandlerEvent,
protocols_handler::ProtocolsHandlerUpgrErr,
upgrade::DeniedUpgrade
};
use log::warn;
@@ -101,7 +103,7 @@ where
fn inject_inbound_closed(&mut self) {}
#[inline]
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, _: io::Error) {}
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, _: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>) {}
#[inline]
fn shutdown(&mut self) {