Software /
code /
prosody
Diff
net/server.lua @ 565:3a49d85cafbc
Backed out changeset 099d8a102deb (committed too much)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 05 Dec 2008 19:49:16 +0000 |
parent | 563:099d8a102deb |
child | 566:c83166927835 |
line wrap: on
line diff
--- a/net/server.lua Fri Dec 05 19:24:01 2008 +0000 +++ b/net/server.lua Fri Dec 05 19:49:16 2008 +0000 @@ -504,24 +504,13 @@ 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 @@ -547,6 +536,9 @@ handler.receivedata = handler._receivedata -- when handshake is done, replace the handshake function with regular functions handler.dispatchdata = handler._dispatchdata handler.need_tls = nil + socketlist[ client ] = handler + readlen = readlen + 1 + readlist[ readlen ] = client return true; else out_put( "server.lua: error during ssl handshake: ", err )