Rename PeerServer -> peer::Server

This commit is contained in:
Henry de Valence 2019-11-27 11:31:35 -08:00 committed by Deirdre Connolly
parent 77191e62f6
commit d1b3e8fe6b
5 changed files with 12 additions and 12 deletions

View File

@ -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;

View File

@ -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<Request> 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<Request> 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 {

View File

@ -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,

View File

@ -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,

View File

@ -34,7 +34,7 @@ pub(super) enum ServerState {
}
/// The "server" duplex half of a peer connection.
pub struct PeerServer<S, Tx> {
pub struct Server<S, Tx> {
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<S, Tx> {
pub(super) peer_tx: Tx,
}
impl<S, Tx> PeerServer<S, Tx>
impl<S, Tx> Server<S, Tx>
where
S: Service<Request, Response = Response, Error = BoxedStdError>,
S::Error: Into<BoxedStdError>,