aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-18 05:06:50 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-18 05:06:50 +0000
commit3ac3b3bc2dc01fea974472dbab1ba232b9ad776c (patch)
tree481d6eee33ae8ae330e446168328612de140b11b /net
parent7c92b4e9a1b3b59d3a9e5a96ec7a16968f46a314 (diff)
downloadprosody-3ac3b3bc2dc01fea974472dbab1ba232b9ad776c.tar.gz
prosody-3ac3b3bc2dc01fea974472dbab1ba232b9ad776c.zip
Flush write queue before closing socket
Diffstat (limited to 'net')
-rw-r--r--net/server.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/server.lua b/net/server.lua
index 3bbe80b4..dece7273 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -225,6 +225,7 @@ wrapsslclient = function( listener, socket, ip, serverport, clientport, mode, ss
--return shutdown( socket, pattern )
end
handler.close = function( closed )
+ if eol then handler._dispatchdata(); end
close( socket )
writelen = ( eol and removesocket( writelist, socket, writelen ) ) or writelen
readlen = removesocket( readlist, socket, readlen )
@@ -364,7 +365,8 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss
local err
socket:settimeout( 0 )
-
+ out_put("setting linger on "..tostring(socket))
+ socket:setoption("linger", { on = true, timeout = 10 });
--// private closures of the object //--
local writequeue = { } -- buffer for messages to send
@@ -404,6 +406,7 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss
--return shutdown( socket, pattern )
end
handler.close = function( closed )
+ if eol then handler._dispatchdata(); end
close( socket )
writelen = ( eol and removesocket( writelist, socket, writelen ) ) or writelen
readlen = removesocket( readlist, socket, readlen )
@@ -614,6 +617,7 @@ wraptcpclient = function( listener, socket, ip, serverport, clientport, mode )
return shutdown( socket, pattern )
end
handler.close = function( closed )
+ if eol then handler._dispatchdata(); end
_ = not closed and shutdown( socket )
_ = not closed and close( socket )
writelen = ( eol and removesocket( writelist, socket, writelen ) ) or writelen