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
40
41
42
43
44
45
46
47
mod concurrent_listener;
mod failover_listener;
mod parsed_listener;
mod tcp_listener;
mod to_listener;
#[cfg(unix)]
mod unix_listener;
use crate::Server;
use async_std::io;
pub use concurrent_listener::ConcurrentListener;
pub use failover_listener::FailoverListener;
pub use to_listener::ToListener;
pub(crate) use parsed_listener::ParsedListener;
pub(crate) use tcp_listener::TcpListener;
#[cfg(unix)]
pub(crate) use unix_listener::UnixListener;
#[async_trait::async_trait]
pub trait Listener<State: 'static>:
std::fmt::Debug + std::fmt::Display + Send + Sync + 'static
{
async fn listen(&mut self, app: Server<State>) -> io::Result<()>;
}
pub(crate) fn is_transient_error(e: &io::Error) -> bool {
use io::ErrorKind::*;
matches!(
e.kind(),
ConnectionRefused | ConnectionAborted | ConnectionReset
)
}