Rename PeerConnector -> peer::Connector
This commit is contained in:
parent
778e49b127
commit
ad6525574b
|
|
@ -12,7 +12,7 @@ mod handshake;
|
||||||
mod server;
|
mod server;
|
||||||
|
|
||||||
pub use client::Client;
|
pub use client::Client;
|
||||||
pub use connector::PeerConnector;
|
pub use connector::Connector;
|
||||||
pub use error::{HandshakeError, PeerError, SharedPeerError};
|
pub use error::{HandshakeError, PeerError, SharedPeerError};
|
||||||
pub use handshake::Handshake;
|
pub use handshake::Handshake;
|
||||||
pub use server::Server;
|
pub use server::Server;
|
||||||
|
|
|
||||||
|
|
@ -14,25 +14,25 @@ use super::{HandshakeError, Client, Handshake};
|
||||||
/// A wrapper around [`peer::Handshake`] that opens a TCP connection before
|
/// A wrapper around [`peer::Handshake`] that opens a TCP connection before
|
||||||
/// forwarding to the inner handshake service. Writing this as its own
|
/// forwarding to the inner handshake service. Writing this as its own
|
||||||
/// [`tower::Service`] lets us apply unified timeout policies, etc.
|
/// [`tower::Service`] lets us apply unified timeout policies, etc.
|
||||||
pub struct PeerConnector<S> {
|
pub struct Connector<S> {
|
||||||
handshaker: Handshake<S>,
|
handshaker: Handshake<S>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Clone> Clone for PeerConnector<S> {
|
impl<S: Clone> Clone for Connector<S> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Connector {
|
||||||
handshaker: self.handshaker.clone(),
|
handshaker: self.handshaker.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> PeerConnector<S> {
|
impl<S> Connector<S> {
|
||||||
pub fn new(handshaker: Handshake<S>) -> Self {
|
pub fn new(handshaker: Handshake<S>) -> Self {
|
||||||
Self { handshaker }
|
Connector { handshaker }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> Service<SocketAddr> for PeerConnector<S>
|
impl<S> Service<SocketAddr> for Connector<S>
|
||||||
where
|
where
|
||||||
S: Service<Request, Response = Response, Error = BoxedStdError> + Clone + Send + 'static,
|
S: Service<Request, Response = Response, Error = BoxedStdError> + Clone + Send + 'static,
|
||||||
S::Future: Send,
|
S::Future: Send,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ use tower_load::{peak_ewma::PeakEwmaDiscover, NoInstrument};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
peer,
|
peer,
|
||||||
peer::{PeerConnector},
|
|
||||||
timestamp_collector::TimestampCollector,
|
timestamp_collector::TimestampCollector,
|
||||||
AddressBook, BoxedStdError, Config, Request, Response,
|
AddressBook, BoxedStdError, Config, Request, Response,
|
||||||
};
|
};
|
||||||
|
|
@ -67,7 +66,7 @@ where
|
||||||
let hs = peer::Handshake::new(config.clone(), inbound_service, timestamp_collector);
|
let hs = peer::Handshake::new(config.clone(), inbound_service, timestamp_collector);
|
||||||
(
|
(
|
||||||
hs_timeout.layer(hs.clone()),
|
hs_timeout.layer(hs.clone()),
|
||||||
hs_timeout.layer(PeerConnector::new(hs)),
|
hs_timeout.layer(peer::Connector::new(hs)),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue