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