Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement setting non-blocking status on all fds

  • Loading branch information...
commit cd0fb83831e6f81d6e1ca8e44992c86312ebff5c 1 parent 0ea0a78
@tailhook authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core.c
View
4 src/core.c
@@ -14,6 +14,7 @@
#include <ctype.h>
#include <math.h>
#include <endian.h>
+#include <fcntl.h>
#include <openssl/sha.h>
@@ -1165,6 +1166,9 @@ int ws_server_start(ws_server_t *serv) {
}
int ws_add_fd(ws_server_t *serv, int fd) {
+ int flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+
ws_listener_t *l = (ws_listener_t *)malloc(sizeof(ws_listener_t));
if(!l) {
return -1;
Please sign in to comment.
Something went wrong with that request. Please try again.