Skip to content

Commit

Permalink
fix: set systemd socket in non-blocking mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Jun 3, 2024
1 parent 6720114 commit cb09f91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ impl Server {
warn!("LISTEN_FDS should be 1, ignoring extra fds");
}

let socket = unsafe { TcpSocket::from_raw_fd(3) };
let stream = unsafe { std::net::TcpStream::from_raw_fd(3) };
stream.set_nonblocking(true)?;

let socket = TcpSocket::from_std_stream(stream);
socket.set_nodelay(true)?;
socket
} else {
Expand Down

0 comments on commit cb09f91

Please sign in to comment.