Struct rabble::TcpServerHandler
[−]
[src]
pub struct TcpServerHandler<C, S> where
C: ConnectionHandler<ClientMsg = S::Msg>,
S: Serialize, { /* fields omitted */ }
A service handler for an async TCP server
Methods
impl<'de, C, S> TcpServerHandler<C, S> where
C: ConnectionHandler<ClientMsg = S::Msg>,
S: Serialize,
C::Msg: Serialize + Deserialize<'de> + Clone + Debug,
[src]
C: ConnectionHandler<ClientMsg = S::Msg>,
S: Serialize,
C::Msg: Serialize + Deserialize<'de> + Clone + Debug,
fn new(
pid: Pid,
addr: &str,
request_timeout: usize,
connection_timeout: Option<usize>
) -> TcpServerHandler<C, S>
pid: Pid,
addr: &str,
request_timeout: usize,
connection_timeout: Option<usize>
) -> TcpServerHandler<C, S>
Create a new TcpServerHandler
Bind to addr
and close a connection that hasn't received a message in connection_timeout
ms. Note that the connection timeout is optional.
Every request with a CorrelationId is also tracked with a timer. This request_timeout
is
not optional as every request can potentially fail, or be delayed indefinitely.
Trait Implementations
impl<'de, C, S> ServiceHandler<C::Msg> for TcpServerHandler<C, S> where
C: ConnectionHandler<ClientMsg = S::Msg>,
S: Serialize,
C::Msg: Serialize + Deserialize<'de> + Clone + Debug,
[src]
C: ConnectionHandler<ClientMsg = S::Msg>,
S: Serialize,
C::Msg: Serialize + Deserialize<'de> + Clone + Debug,
fn init(&mut self, registrar: &Registrar, _node: &Node<C::Msg>) -> Result<()>
Initialize the state of the handler: Register timers and tcp listen socket
fn handle_notification(
&mut self,
node: &Node<C::Msg>,
notification: Notification,
registrar: &Registrar
) -> Result<()>
&mut self,
node: &Node<C::Msg>,
notification: Notification,
registrar: &Registrar
) -> Result<()>
Handle any poll notifications
fn handle_envelope(
&mut self,
node: &Node<C::Msg>,
envelope: Envelope<C::Msg>,
_registrar: &Registrar
) -> Result<()>
&mut self,
node: &Node<C::Msg>,
envelope: Envelope<C::Msg>,
_registrar: &Registrar
) -> Result<()>
Handle an envelope from a process or service