mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 22:27:38 +03:00
Merge
This commit is contained in:
commit
fe6e46a55f
6 changed files with 7 additions and 35 deletions
|
@ -501,24 +501,13 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss
|
|||
handler.starttls = function (now)
|
||||
if not now then out_put("server.lua: we need to do tls, but delaying until later"); handler.need_tls = true; return; end
|
||||
out_put( "server.lua: attempting to start tls on "..tostring(socket) )
|
||||
local oldsocket = socket;
|
||||
socket, err = ssl_wrap( socket, sslctx ) -- wrap socket
|
||||
out_put("sslwrapped socket is "..tostring(socket));
|
||||
if err then
|
||||
out_put( "server.lua: ssl error: ", err )
|
||||
return nil, nil, err -- fatal error
|
||||
end
|
||||
socket:settimeout(0);
|
||||
|
||||
-- Add the new socket to our system
|
||||
socketlist[ socket ] = handler
|
||||
readlen = readlen + 1
|
||||
readlist[ readlen ] = socket
|
||||
|
||||
-- Remove traces of the old socket
|
||||
readlen = removesocket( readlist, oldsocket, readlen )
|
||||
socketlist [ oldsocket ] = nil;
|
||||
|
||||
socket:settimeout( 1 )
|
||||
send = socket.send
|
||||
receive = socket.receive
|
||||
close = socket.close
|
||||
|
@ -543,7 +532,7 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss
|
|||
out_put( "server.lua: ssl handshake done" )
|
||||
writelen = ( wrote and removesocket( writelist, socket, writelen ) ) or writelen
|
||||
handler.receivedata = handler._receivedata -- when handshake is done, replace the handshake function with regular functions
|
||||
handler.dispatchdata = handler._dispatchdata
|
||||
handler.dispatchdata = handler._dispatchdata;
|
||||
return true;
|
||||
else
|
||||
out_put( "server.lua: error during ssl handshake: ", err )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue