1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
mod builder;
mod service;
pub use self::builder::ServerBuilder;
pub use self::service::{handle_one, Server, ServerHandler};
use crate::frame;
#[derive(thiserror::Error, Debug)]
pub enum ServerError<E> {
#[error("Message handler service error")]
Service(E),
#[error("Http/2 codec error: {0}")]
Frame(#[from] frame::FrameError),
#[error("Dispatcher error")]
Dispatcher,
#[error("Control service init error")]
ControlServiceError,
#[error("Publish service init error")]
PublishServiceError,
#[error("Handshake timeout")]
HandshakeTimeout,
#[error("Peer is disconnected, error: {0:?}")]
Disconnected(Option<std::io::Error>),
}
impl<E> From<std::io::Error> for ServerError<E> {
fn from(err: std::io::Error) -> Self {
ServerError::Disconnected(Some(err))
}
}