mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 14:00:01 -04:00
make accept errors nonfatal, fixes #6, also default to stats endpoint off
This commit is contained in:
parent
7fdacb2623
commit
f798b5544e
3 changed files with 13 additions and 12 deletions
|
@ -262,7 +262,7 @@ impl Default for ServerConfig {
|
|||
|
||||
verbose_stats: true,
|
||||
stats_endpoint: "/stats".to_string(),
|
||||
enable_stats_endpoint: true,
|
||||
enable_stats_endpoint: false,
|
||||
|
||||
non_ws_response: ":3".to_string(),
|
||||
|
||||
|
|
|
@ -338,11 +338,7 @@ impl ServerListener {
|
|||
SocketType::TlsUnix => {
|
||||
Self::TlsUnix(Self::bind_unix().await?, Self::create_tls().await?)
|
||||
}
|
||||
SocketType::File => {
|
||||
Self::File(Some(PathBuf::try_from(&CONFIG.server.bind).with_context(
|
||||
|| format!("failed to parse path `{}` for file", CONFIG.server.bind),
|
||||
)?))
|
||||
}
|
||||
SocketType::File => Self::File(Some(CONFIG.server.bind.clone().into())),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -200,13 +200,18 @@ async fn main() -> anyhow::Result<()> {
|
|||
|
||||
let mut listener = ServerListener::new().await?;
|
||||
loop {
|
||||
let (stream, id) = listener.accept().await?;
|
||||
tokio::spawn(async move {
|
||||
let res = route::route(stream, move |stream| handle_stream(stream, id)).await;
|
||||
let ret = listener.accept().await;
|
||||
match ret {
|
||||
Ok((stream, id)) => {
|
||||
tokio::spawn(async move {
|
||||
let res = route::route(stream, move |stream| handle_stream(stream, id)).await;
|
||||
|
||||
if let Err(e) = res {
|
||||
error!("error while routing client: {:?}", e);
|
||||
if let Err(e) = res {
|
||||
error!("error while routing client: {:?}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Err(e) => error!("error while accepting client: {:?}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue