summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-08-08 17:59:58 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-08-08 18:00:16 +0200
commit0b4128a07be87a9efb189a88d9ab694914cf0d3b (patch)
treef2b6c70280383f89fcba2518ff1e399df49ada88
parentd74e7deb791ed0949525139c3bad46d687af6550 (diff)
fix blocking read
Change-Id: I7e39d4ce7c0f83e3398f344ade7e5114cf203efb Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-api-ws.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c
index e81306a3..1049a07b 100644
--- a/src/afb-api-ws.c
+++ b/src/afb-api-ws.c
@@ -1023,6 +1023,8 @@ static void api_ws_server_accept(struct api_ws *api)
lenaddr = (socklen_t)sizeof addr;
client->fd = accept(api->fd, &addr, &lenaddr);
if (client->fd >= 0) {
+ fcntl(client->fd, F_SETFD, FD_CLOEXEC);
+ fcntl(client->fd, F_SETFL, O_NONBLOCK);
client->ws = afb_ws_create(afb_common_get_event_loop(), client->fd, &api_ws_server_ws_itf, client);
if (client->ws != NULL) {
client->api = api->api;