cmd/docker-proxy: set O_NONBLOCK unconditionally

Prior to commit b5bf89c31, all socket fds passed to the docker-proxy
were getting the O_NONBLOCK flag set. However, that commit added support
for SCTP socket-passing, and had to conditionally guard this behavior to
not use it on SCTP sockets due to ishidawataru/sctp not clearing the
flag.

A fix was made in ishidawataru/sctp (see [1]), so we can remove that
condition.

[1]: https://github.com/ishidawataru/sctp/commit/4b890084db30

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton
2025-08-29 07:50:39 +02:00
parent 12897011fa
commit 9dc0c094e6

View File

@@ -178,11 +178,7 @@ func parseFlags() ProxyConfig {
}
if useListenFd {
// Unlike the stdlib, passing a non-blocking socket to `sctp.FileListener`
// will result in a non-blocking Accept(). So, do not set this flag for SCTP.
if config.Proto != "sctp" {
_ = syscall.SetNonblock(int(listenSockFd), true)
}
_ = syscall.SetNonblock(int(listenSockFd), true)
config.ListenSock = os.NewFile(listenSockFd, "listen-sock")
}