mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
Flush write queue before closing socket
This commit is contained in:
parent
7c92b4e9a1
commit
3ac3b3bc2d
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue