From d1b3e8fe6b84e3cf17a5ce829e76ea9929e14d7c Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Wed, 27 Nov 2019 11:31:35 -0800 Subject: [PATCH] Rename PeerServer -> peer::Server --- zebra-network/src/peer.rs | 2 +- zebra-network/src/peer/client.rs | 6 +++--- zebra-network/src/peer/error.rs | 8 ++++---- zebra-network/src/peer/handshake.rs | 4 ++-- zebra-network/src/peer/server.rs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/zebra-network/src/peer.rs b/zebra-network/src/peer.rs index b82f3d99..ca563ce3 100644 --- a/zebra-network/src/peer.rs +++ b/zebra-network/src/peer.rs @@ -15,4 +15,4 @@ pub use client::Client; pub use connector::PeerConnector; pub use error::{HandshakeError, PeerError, SharedPeerError}; pub use handshake::PeerHandshake; -pub use server::PeerServer; +pub use server::Server; diff --git a/zebra-network/src/peer/client.rs b/zebra-network/src/peer/client.rs index 4889bd0a..4c448118 100644 --- a/zebra-network/src/peer/client.rs +++ b/zebra-network/src/peer/client.rs @@ -21,7 +21,7 @@ pub struct Client { pub(super) error_slot: ErrorSlot, } -/// A message from the `peer::Client` to the `PeerServer`, containing both a +/// A message from the `peer::Client` to the `peer::Server`, containing both a /// request and a return message channel. The reason the return channel is /// included is because `peer::Client::call` returns a future that may be moved /// around before it resolves, so the future must have ownership of the channel @@ -43,7 +43,7 @@ impl Service for Client { Poll::Ready(Err(self .error_slot .try_get_error() - .expect("failed PeerServers must set their error slot"))) + .expect("failed servers must set their error slot"))) } else { Poll::Ready(Ok(())) } @@ -60,7 +60,7 @@ impl Service for Client { future::ready(Err(self .error_slot .try_get_error() - .expect("failed PeerServers must set their error slot"))) + .expect("failed servers must set their error slot"))) .instrument(self.span.clone()) .boxed() } else { diff --git a/zebra-network/src/peer/error.rs b/zebra-network/src/peer/error.rs index 8f7b20ea..7eba487d 100644 --- a/zebra-network/src/peer/error.rs +++ b/zebra-network/src/peer/error.rs @@ -15,14 +15,14 @@ pub enum PeerError { /// The remote peer closed the connection. #[error("Peer closed connection")] ConnectionClosed, - /// The [`peer::Client`] half of the [`peer::Client`]/[`PeerServer`] pair died before + /// The [`peer::Client`] half of the [`peer::Client`]/[`peer::Server`] pair died before /// the [`Server`] half did. #[error("peer::Client instance died")] DeadClient, - /// The [`PeerServer`] half of the [`PeerServer`]/[`peer::Client`] pair died before + /// The [`peer::Server`] half of the [`peer::Server`]/[`peer::Client`] pair died before /// the [`peer::Client`] half did. - #[error("PeerServer instance died")] - DeadPeerServer, + #[error("peer::Server instance died")] + DeadServer, /// The remote peer did not respond to a [`peer::Client`] request in time. #[error("Client request timed out")] ClientRequestTimeout, diff --git a/zebra-network/src/peer/handshake.rs b/zebra-network/src/peer/handshake.rs index 39bece0e..7b5defc5 100644 --- a/zebra-network/src/peer/handshake.rs +++ b/zebra-network/src/peer/handshake.rs @@ -25,7 +25,7 @@ use crate::{ BoxedStdError, Config, }; -use super::{error::ErrorSlot, server::ServerState, HandshakeError, Client, PeerServer}; +use super::{error::ErrorSlot, server::ServerState, HandshakeError, Client, Server}; /// A [`Service`] that handshakes with a remote peer and constructs a /// client/server pair. @@ -192,7 +192,7 @@ where let (peer_tx, peer_rx) = stream.split(); - let server = PeerServer { + let server = Server { state: ServerState::AwaitingRequest, svc: internal_service, client_rx: server_rx, diff --git a/zebra-network/src/peer/server.rs b/zebra-network/src/peer/server.rs index e5309e52..28e2d695 100644 --- a/zebra-network/src/peer/server.rs +++ b/zebra-network/src/peer/server.rs @@ -34,7 +34,7 @@ pub(super) enum ServerState { } /// The "server" duplex half of a peer connection. -pub struct PeerServer { +pub struct Server { pub(super) state: ServerState, /// A timeout for a client request. This is stored separately from /// ServerState so that we can move the future out of it independently of @@ -48,7 +48,7 @@ pub struct PeerServer { pub(super) peer_tx: Tx, } -impl PeerServer +impl Server where S: Service, S::Error: Into,