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

This commit is contained in:
Sergey Lyubka committed 2014-02-24 08:22:40 +00:00
1 parent 9bbf4c8384
commit 107902bae4
1 file changed
+5 -3
+5 -3
View File
@@ -741,9 +741,11 @@ 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) {
if (sock >= 0) FD_SET(sock, set);
if (sock > *max_fd) {
*max_fd = sock;
if (sock != INVALID_SOCKET) {
FD_SET(sock, set);
if (*max_fd == INVALID_SOCKET || sock > *max_fd) {
*max_fd = sock;
}
}
}