net.server_epoll: Special handling of signal interrupts
authorKim Alvefur <zash@zash.se>
Fri, 12 Oct 2018 03:22:09 +0200
changeset 9511 2055b497b515
parent 9510 33d21f020b66
child 9512 b57353f76c83
net.server_epoll: Special handling of signal interrupts
net/server_epoll.lua
util-src/poll.c
--- a/net/server_epoll.lua	Fri Oct 12 03:21:11 2018 +0200
+++ b/net/server_epoll.lua	Fri Oct 12 03:22:09 2018 +0200
@@ -742,7 +742,7 @@
 				log("debug", "Removing unknown fd %d", fd);
 				poll:del(fd);
 			end
-		elseif r ~= "timeout" then
+		elseif r ~= "timeout" and r ~= "signal" then
 			log("debug", "epoll_wait error: %s[%d]", r, w);
 		end
 	until once or (quitting and next(fds) == nil);
--- a/util-src/poll.c	Fri Oct 12 03:21:11 2018 +0200
+++ b/util-src/poll.c	Fri Oct 12 03:22:09 2018 +0200
@@ -316,6 +316,11 @@
 		lua_pushstring(L, "timeout");
 		return 2;
 	}
+	else if(ret < 0 && errno == EINTR) {
+		lua_pushnil(L);
+		lua_pushstring(L, "signal");
+		return 2;
+	}
 	else if(ret < 0) {
 		ret = errno;
 		lua_pushnil(L);