Software /
code /
prosody
Changeset
12011:9dc36fdbdba1
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
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 06 Dec 2021 10:59:14 +0100 |
parents | 12010:f995d62044fa |
children | 12012:71d799a8638f |
files | net/server_epoll.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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