diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-07-02 17:24:40 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-07-02 17:24:40 +0100 |
commit | e563e751d0f7293ebd22cc9d8896c6cd041c1bf6 (patch) | |
tree | 8481da1c7e886eab12c141f6d6a767f5e461f1c7 /net | |
parent | 10f55df529fb4c31f847cb5c5abef446432f783c (diff) | |
download | prosody-e563e751d0f7293ebd22cc9d8896c6cd041c1bf6.tar.gz prosody-e563e751d0f7293ebd22cc9d8896c6cd041c1bf6.zip |
net.server_select: Clean up buffer and fire drained callback on successful write before we try and start TLS negotiation (if negotiation fails instantly then we can be left without a handler to use for cleanup) (thanks dersd)
Diffstat (limited to 'net')
-rw-r--r-- | net/server_select.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/server_select.lua b/net/server_select.lua index 4eb82b97..298e560a 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -479,11 +479,11 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport bufferqueuelen = 0 bufferlen = 0 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) -- delete socket from writelist - _ = needtls and handler:starttls(nil, true) _writetimes[ handler ] = nil if drain then drain(handler) end + _ = needtls and handler:starttls(nil, true) _ = toclose and handler:close( ) return true elseif byte and ( err == "timeout" or err == "wantwrite" ) then -- want write |