From: Miroslav Lichvar Date: Mon, 21 May 2018 14:27:43 +0000 (+0200) Subject: ntp: enable non-blocking mode on server sockets X-Git-Tag: 3.4-pre1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76bed76289575ba1640c02d370ae5304ef8c5fe2;p=thirdparty%2Fchrony.git ntp: enable non-blocking mode on server sockets Avoid blocking in sendmsg() due to a full send buffer. --- diff --git a/ntp_io.c b/ntp_io.c index 5c8c47a9..3a3398ac 100644 --- a/ntp_io.c +++ b/ntp_io.c @@ -142,6 +142,10 @@ prepare_socket(int family, int port_number, int client_only) /* Close on exec */ UTI_FdSetCloexec(sock_fd); + /* Enable non-blocking mode on server sockets */ + if (!client_only && fcntl(sock_fd, F_SETFL, O_NONBLOCK)) + DEBUG_LOG("Could not set O_NONBLOCK : %s", strerror(errno)); + /* Prepare local address */ memset(&my_addr, 0, sizeof (my_addr)); my_addr_len = 0;