From ef5e5e6691f02844499c57f16b0bb470a83aa92f Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 24 Aug 2020 17:37:53 +0200 Subject: Plop now makes sure that client fd is nonblocking --- plop.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plop.c b/plop.c index ec7eb3d..1e34c99 100644 --- a/plop.c +++ b/plop.c @@ -195,6 +195,12 @@ int handle_server(lua_State * L, const int efd, const int server) } } + if (-1 == fcntl(client, F_SETFL, (fcntl(client, F_GETFL, 0) | O_NONBLOCK))) + { + close(client); + return 0; // TODO: Retriage this error at some point. + } + // TODO: Request is not the enitre state of the client. Make them distinct along with responses. struct request * request = new_request(L); if (NULL == request) -- cgit v1.1