diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-12-05 19:55:46 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-12-05 19:55:46 +0000 |
commit | d9173986d5e120c9285fcda58aaf0fa977279414 (patch) | |
tree | 9a4d887c1f91a004f741d83a60aa4d2420048458 /net/server.lua | |
parent | fe6e46a55f68f566290250655247cd1393ae6d2c (diff) | |
download | prosody-d9173986d5e120c9285fcda58aaf0fa977279414.tar.gz prosody-d9173986d5e120c9285fcda58aaf0fa977279414.zip |
Re-commit TLS fix
Diffstat (limited to 'net/server.lua')
-rw-r--r-- | net/server.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/server.lua b/net/server.lua index e01ddfb7..55afcf3f 100644 --- a/net/server.lua +++ b/net/server.lua @@ -501,13 +501,24 @@ 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( 1 ) + 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; + send = socket.send receive = socket.receive close = socket.close |