Changeset

9320:8cc498cb0df7

net.server_epoll: Add back setflags API for compat
author Kim Alvefur <zash@zash.se>
date Sat, 15 Sep 2018 14:24:09 +0200
parents 9319:7c954c75b6ac
children 9321:146dc1e4c7ff
files net/server_epoll.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sat Sep 15 14:20:01 2018 +0200
+++ b/net/server_epoll.lua	Sat Sep 15 14:24:09 2018 +0200
@@ -310,6 +310,19 @@
 	return true;
 end
 
+function interface:setflags(r, w)
+	if not(self._wantread or self._wantwrite) then
+		if not(r or w) then
+			return true; -- no change
+		end
+		return self:add(r, w);
+	end
+	if not(r or w) then
+		return self:del();
+	end
+	return self:set(r, w);
+end
+
 -- Called when socket is readable
 function interface:onreadable()
 	local data, err, partial = self.conn:receive(self.read_size or cfg.read_size);