# HG changeset patch # User Kim Alvefur # Date 1638784754 -3600 # Node ID 9dc36fdbdba19e64eb2288aae65e0b48cfd536f0 # Parent f995d62044fab5c6af4d784f11c06562d3f8cbda net.server_epoll: Ensure calls to :write() return something With opportunistic writes enabled, writes can return what :onwritable() returns, thus :onwritable() should return something sensible at each spot. Should prevent whatever caused > Error writing to connection: (nil) Tho this was probably harmless diff -r f995d62044fa -r 9dc36fdbdba1 net/server_epoll.lua --- a/net/server_epoll.lua Sun Dec 05 14:49:06 2021 +0100 +++ b/net/server_epoll.lua Mon Dec 06 10:59:14 2021 +0100 @@ -489,7 +489,7 @@ function interface:onwritable() self._writing = true; -- prevent reentrant writes etc self:onconnect(); - if not self.conn then return; end -- could have been closed in onconnect + if not self.conn then return nil, "no-conn"; end -- could have been closed in onconnect self:on("predrain"); local buffer = self.writebuffer; local data = buffer or ""; @@ -542,6 +542,7 @@ self:destroy(); return ok, err; end + return true, err; end -- The write buffer has been successfully emptied