mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
aquatic_ws: add more anyhow error context annotations
This commit is contained in:
parent
65684472a6
commit
b9ee290ca0
4 changed files with 19 additions and 12 deletions
|
|
@ -42,7 +42,7 @@ pub fn run_socket_worker(
|
|||
},
|
||||
Err(err) => {
|
||||
socket_worker_statuses.lock()[socket_worker_index] = Some(
|
||||
Err(format!("Couldn't create TCP listener: {}", err))
|
||||
Err(format!("Couldn't open socket: {:#}", err))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,19 +16,24 @@ pub fn create_listener(
|
|||
TcpBuilder::new_v4()
|
||||
} else {
|
||||
TcpBuilder::new_v6()
|
||||
}?;
|
||||
}.context("Couldn't create TcpBuilder")?;
|
||||
|
||||
if config.network.ipv6_only {
|
||||
builder = builder.only_v6(true)
|
||||
.context("Failed setting ipv6_only to true")?
|
||||
.context("Couldn't put socket in ipv6 only mode")?
|
||||
}
|
||||
|
||||
builder = builder.reuse_port(true)?;
|
||||
builder = builder.bind(&config.network.address)?;
|
||||
builder = builder.reuse_port(true)
|
||||
.context("Couldn't put socket in reuse_port mode")?;
|
||||
builder = builder.bind(&config.network.address).with_context(||
|
||||
format!("Couldn't bind socket to address {}", config.network.address)
|
||||
)?;
|
||||
|
||||
let listener = builder.listen(128)?;
|
||||
let listener = builder.listen(128)
|
||||
.context("Couldn't listen for connections on socket")?;
|
||||
|
||||
listener.set_nonblocking(true)?;
|
||||
listener.set_nonblocking(true)
|
||||
.context("Couldn't put tcp listener in non-blocking mode")?;
|
||||
|
||||
Ok(listener)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue