From b993764a145fc991260a0cdb5079b4cf6a30d0bd Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Tue, 16 Feb 2016 21:42:01 +0000 Subject: [PATCH] Set client FDs non-blocking. --- client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client.c b/client.c index 91186d9..5fa3292 100644 --- a/client.c +++ b/client.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "json.h" #include "client.h" @@ -51,6 +53,11 @@ static bool client_hello(int fd, struct serializer *serializer) { } void client_add(int fd, struct serializer *serializer) { + int flags = fcntl(fd, F_GETFL, 0); + assert(flags >= 0); + flags |= O_NONBLOCK; + assert(fcntl(fd, F_SETFL, flags) == 0); + if (!client_hello(fd, serializer)) { return; }