fix bug in websocket client
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 18 May 2016 08:05:01 +0000 (10:05 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 18 May 2016 08:05:01 +0000 (10:05 +0200)
Change-Id: I45c44f31c02ac81dc41127fe35024a57b8d4be33
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-ws-client.c

index 2569d13..32f8778 100644 (file)
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
+#include <fcntl.h>
 
 #include "afb-wsj1.h"
 
@@ -365,8 +366,10 @@ struct afb_wsj1 *afb_ws_client_connect_wsj1(const char *uri, struct afb_wsj1_itf
                                rc = negociate(fd, proto_json1, path, xhost);
                                if (rc == 0) {
                                        result = afb_wsj1_create(fd, itf, closure);
-                                       if (result != NULL)
+                                       if (result != NULL) {
+                                               fcntl(fd, F_SETFL, O_NONBLOCK);
                                                break;
+                                       }
                                }
                        }
                        close(fd);