Commit 107902ba authored by Sergey Lyubka's avatar Sergey Lyubka

add_to_set(): fix around non-negative SOCKET on Windows

parent 9bbf4c83
...@@ -741,10 +741,12 @@ int ns_send(struct ns_connection *conn, const void *buf, int len) { ...@@ -741,10 +741,12 @@ int ns_send(struct ns_connection *conn, const void *buf, int len) {
} }
static void add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) { static void add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) {
if (sock >= 0) FD_SET(sock, set); if (sock != INVALID_SOCKET) {
if (sock > *max_fd) { FD_SET(sock, set);
if (*max_fd == INVALID_SOCKET || sock > *max_fd) {
*max_fd = sock; *max_fd = sock;
} }
}
} }
int ns_server_poll(struct ns_server *server, int milli) { int ns_server_poll(struct ns_server *server, int milli) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment