Skip to content

Commit

Permalink
Fix blocking-mode tcp listener in auto-reload example (#2558)
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Jan 31, 2024
1 parent 530aa55 commit 5f7fcc5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/auto-reload/src/main.rs
Expand Up @@ -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(),
};
Expand Down

0 comments on commit 5f7fcc5

Please sign in to comment.