aboutsummaryrefslogtreecommitdiffstats
path: root/net/server.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-12-05 19:49:16 +0000
committerMatthew Wild <mwild1@gmail.com>2008-12-05 19:49:16 +0000
commitc016526d9d5b57c8b6157cba7eee4bb268e1e9b4 (patch)
tree9a0fe48f76564edcc95b6dad8ddcef79d4a8f85b /net/server.lua
parent0d2b952b610069996f733700117a2e62d5b73696 (diff)
downloadprosody-c016526d9d5b57c8b6157cba7eee4bb268e1e9b4.tar.gz
prosody-c016526d9d5b57c8b6157cba7eee4bb268e1e9b4.zip
Backed out changeset 099d8a102deb (committed too much)
Diffstat (limited to 'net/server.lua')
-rw-r--r--net/server.lua16
1 files changed, 4 insertions, 12 deletions
diff --git a/net/server.lua b/net/server.lua
index d840d51b..9d178cb2 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -504,24 +504,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
@@ -547,6 +536,9 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss
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 )