mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 08:41:36 +00:00
fix(core): remove UpgradeError
from public API
Not making this private was an oversight from an earlier refactoring. Related: #3915. Pull-Request: #4012.
This commit is contained in:
@ -125,7 +125,7 @@ pub use peer_record::PeerRecord;
|
|||||||
pub use signed_envelope::SignedEnvelope;
|
pub use signed_envelope::SignedEnvelope;
|
||||||
pub use translation::address_translation;
|
pub use translation::address_translation;
|
||||||
pub use transport::Transport;
|
pub use transport::Transport;
|
||||||
pub use upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeError, UpgradeInfo};
|
pub use upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
@ -69,11 +69,11 @@ mod transfer;
|
|||||||
pub(crate) use apply::{
|
pub(crate) use apply::{
|
||||||
apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply,
|
apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply,
|
||||||
};
|
};
|
||||||
|
pub(crate) use error::UpgradeError;
|
||||||
use futures::future::Future;
|
use futures::future::Future;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
denied::DeniedUpgrade,
|
denied::DeniedUpgrade,
|
||||||
error::UpgradeError,
|
|
||||||
pending::PendingUpgrade,
|
pending::PendingUpgrade,
|
||||||
ready::ReadyUpgrade,
|
ready::ReadyUpgrade,
|
||||||
select::SelectUpgrade,
|
select::SelectUpgrade,
|
||||||
|
@ -1776,20 +1776,18 @@ fn p2p_addr(peer: Option<PeerId>, addr: Multiaddr) -> Result<Multiaddr, Multiadd
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test::{CallTraceBehaviour, MockBehaviour};
|
use crate::test::{CallTraceBehaviour, MockBehaviour};
|
||||||
use either::Either;
|
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use futures::executor::ThreadPool;
|
use futures::executor::ThreadPool;
|
||||||
use futures::{executor, future};
|
use futures::{executor, future};
|
||||||
use libp2p_core::multiaddr::multiaddr;
|
use libp2p_core::multiaddr::multiaddr;
|
||||||
use libp2p_core::transport::memory::MemoryTransportError;
|
use libp2p_core::transport::memory::MemoryTransportError;
|
||||||
use libp2p_core::transport::TransportEvent;
|
use libp2p_core::transport::TransportEvent;
|
||||||
|
use libp2p_core::Endpoint;
|
||||||
use libp2p_core::{multiaddr, transport, upgrade};
|
use libp2p_core::{multiaddr, transport, upgrade};
|
||||||
use libp2p_core::{Endpoint, UpgradeError};
|
|
||||||
use libp2p_identity as identity;
|
use libp2p_identity as identity;
|
||||||
use libp2p_plaintext as plaintext;
|
use libp2p_plaintext as plaintext;
|
||||||
use libp2p_yamux as yamux;
|
use libp2p_yamux as yamux;
|
||||||
use quickcheck::*;
|
use quickcheck::*;
|
||||||
use void::Void;
|
|
||||||
|
|
||||||
// Test execution state.
|
// Test execution state.
|
||||||
// Connection => Disconnecting => Connecting.
|
// Connection => Disconnecting => Connecting.
|
||||||
@ -2374,15 +2372,13 @@ mod tests {
|
|||||||
"/ip4/127.0.0.1/tcp/80".parse().unwrap(),
|
"/ip4/127.0.0.1/tcp/80".parse().unwrap(),
|
||||||
TransportError::Other(io::Error::new(
|
TransportError::Other(io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
Either::<_, Void>::Left(Either::<Void, _>::Right(UpgradeError::Apply(
|
|
||||||
MemoryTransportError::Unreachable,
|
MemoryTransportError::Unreachable,
|
||||||
))),
|
|
||||||
)),
|
)),
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let string = format!("{error}");
|
let string = format!("{error}");
|
||||||
|
|
||||||
// Unfortunately, we have some "empty" errors that lead to multiple colons without text but that is the best we can do.
|
// Unfortunately, we have some "empty" errors that lead to multiple colons without text but that is the best we can do.
|
||||||
assert_eq!("Failed to negotiate transport protocol(s): [(/ip4/127.0.0.1/tcp/80: : Handshake failed: No listener on the given port.)]", string)
|
assert_eq!("Failed to negotiate transport protocol(s): [(/ip4/127.0.0.1/tcp/80: : No listener on the given port.)]", string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user