summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2020-08-24 17:37:53 +0200
committerAki <please@ignore.pl>2020-08-24 17:37:53 +0200
commitef5e5e6691f02844499c57f16b0bb470a83aa92f (patch)
treeda84f0e7592298e35e26a7391d49df66dda29d47
parent1667f1be988e9a7f3ae745138b8bd5ecfdc165f5 (diff)
downloadplop-ef5e5e6691f02844499c57f16b0bb470a83aa92f.zip
plop-ef5e5e6691f02844499c57f16b0bb470a83aa92f.tar.gz
plop-ef5e5e6691f02844499c57f16b0bb470a83aa92f.tar.bz2
Plop now makes sure that client fd is nonblocking
-rw-r--r--plop.c6
1 files changed, 6 insertions, 0 deletions
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)