diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-06 10:59:14 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-06 10:59:14 +0100 |
commit | 05a9010c859b4d3caa4775d5a78fb1e287385617 (patch) | |
tree | f2055b4116a793c5888958132dfe026f3dc83d43 /net/server_epoll.lua | |
parent | 2807299fba66bf468dd5c534c63081f9b6ac4ce2 (diff) | |
download | prosody-05a9010c859b4d3caa4775d5a78fb1e287385617.tar.gz prosody-05a9010c859b4d3caa4775d5a78fb1e287385617.zip |
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
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r-- | net/server_epoll.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 62fe3675..f61c204c 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -489,7 +489,7 @@ end 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 @@ function interface:onwritable() self:destroy(); return ok, err; end + return true, err; end -- The write buffer has been successfully emptied |