aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-16 01:21:05 +0200
committerKim Alvefur <zash@zash.se>2021-07-16 01:21:05 +0200
commit8318977ef41196def77aa3d662578e2fb18580b8 (patch)
treecc555f633bbb807a9f5f30b2cdd4b05722cf735c /net
parentc611398c1f1661f070c879cb0da4251d89abf1c1 (diff)
downloadprosody-8318977ef41196def77aa3d662578e2fb18580b8.tar.gz
prosody-8318977ef41196def77aa3d662578e2fb18580b8.zip
net.server_epoll: Propagate returns from opportunistic writes
So that if a write ends up writing directly to the socket, it gets the actual return value
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 2a7a0b28..504dc8d5 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -477,7 +477,7 @@ function interface:onwritable()
end
self:setwritetimeout(false);
self:ondrain(); -- Be aware of writes in ondrain
- return;
+ return ok;
elseif partial then
self:debug("Sent %d out of %d buffered bytes", partial, #data);
buffer[1] = data:sub(partial+1);
@@ -494,6 +494,7 @@ function interface:onwritable()
elseif err ~= "timeout" then
self:on("disconnect", err);
self:destroy();
+ return ok, err;
end
end
@@ -513,9 +514,9 @@ function interface:write(data)
if not self._write_lock then
if cfg.opportunistic_writes and not self._opportunistic_write then
self._opportunistic_write = true;
- self:onwritable();
+ local ret, err = self:onwritable();
self._opportunistic_write = nil;
- return #data;
+ return ret, err;
end
self:setwritetimeout();
self:set(nil, true);