aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commit53e047492b5d5711a5990f7b8e4965723ef2a536 (patch)
tree3a6050d39a400bdab536148f4d44d20984a6f03b /net
parent46c6ab5be36c3b0e245fb068f39a61db7a57d30e (diff)
downloadprosody-53e047492b5d5711a5990f7b8e4965723ef2a536.tar.gz
prosody-53e047492b5d5711a5990f7b8e4965723ef2a536.zip
net.server_epoll: Prevent further writing after closing a socket
Diffstat (limited to 'net')
-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();