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