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))
}
}