aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-18 16:41:22 +0200
committerKim Alvefur <zash@zash.se>2016-08-18 16:41:22 +0200
commitf8cf3d1254bc34bffe1d0b416a9e42b2e2c35311 (patch)
tree3a6050d39a400bdab536148f4d44d20984a6f03b
parent4125f016e0bff612daa481931790cfa0f1c13b5b (diff)
downloadprosody-f8cf3d1254bc34bffe1d0b416a9e42b2e2c35311.tar.gz
prosody-f8cf3d1254bc34bffe1d0b416a9e42b2e2c35311.zip
net.server_epoll: Prevent further writing after closing a socket
-rw-r--r--net/server_epoll.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 62fb9863..89f358a5 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -334,10 +334,13 @@ interface.send = interface.write;
function interface:close()
if self._wantwrite then
+ self:setflags(false, true); -- Flush final buffer contents
+ self.write, self.send = noop, noop; -- No more writing
log("debug", "Close %s after writing", tostring(self));
self._toclose = true;
else
log("debug", "Close %s now", tostring(self));
+ self.write, self.send = noop, noop;
self.close = noop;
self:on("disconnect");
self:destroy();