# HG changeset patch # User Kim Alvefur # Date 1626391265 -7200 # Node ID 1573099157c90561353b55784daf6044252ac03c # Parent d6be4dda1f60743318fa629d6c4d917dbcd064c0 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 diff -r d6be4dda1f60 -r 1573099157c9 net/server_epoll.lua --- a/net/server_epoll.lua Thu Jul 15 01:38:44 2021 +0200 +++ b/net/server_epoll.lua Fri Jul 16 01:21:05 2021 +0200 @@ -477,7 +477,7 @@ 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 @@ elseif err ~= "timeout" then self:on("disconnect", err); self:destroy(); + return ok, err; end end @@ -513,9 +514,9 @@ 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);