mirror of
https://github.com/tokio-rs/axum.git
synced 2025-09-30 22:41:03 +00:00
Fix blocking-mode tcp listener in auto-reload example (#2558)
This commit is contained in:
parent
530aa5530c
commit
5f7fcc5866
@ -16,7 +16,10 @@ async fn main() {
|
||||
let mut listenfd = ListenFd::from_env();
|
||||
let listener = match listenfd.take_tcp_listener(0).unwrap() {
|
||||
// if we are given a tcp listener on listen fd 0, we use that one
|
||||
Some(listener) => TcpListener::from_std(listener).unwrap(),
|
||||
Some(listener) => {
|
||||
listener.set_nonblocking(true).unwrap();
|
||||
TcpListener::from_std(listener).unwrap()
|
||||
}
|
||||
// otherwise fall back to local listening
|
||||
None => TcpListener::bind("127.0.0.1:3000").await.unwrap(),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user