aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-11-28 03:04:50 +0000
committerMatthew Wild <mwild1@gmail.com>2011-11-28 03:04:50 +0000
commit6975f1a07decc49411d37d7f7ab82d92f0104634 (patch)
treeb0e779a384a247a86e70b42d4a5f1d11c8644256
parent9b5a2dada513d319ccce8bd59fc7cc0236e544fc (diff)
downloadprosody-6975f1a07decc49411d37d7f7ab82d92f0104634.tar.gz
prosody-6975f1a07decc49411d37d7f7ab82d92f0104634.zip
net.server_select: Autostart SSL negotiation as the last part of socket setup to avoid a traceback (#262) (thanks Maranda)
-rw-r--r--net/server_select.lua22
1 files changed, 10 insertions, 12 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 412d03c0..8802f620 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -596,25 +596,23 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
handler.sendbuffer = handshake
handshake( socket ) -- do handshake
end
- handler.readbuffer = _readbuffer
- handler.sendbuffer = _sendbuffer
-
- if sslctx then
- out_put "server.lua: auto-starting ssl negotiation..."
- handler.autostart_ssl = true;
- handler:starttls(sslctx);
- end
-
- else
- handler.readbuffer = _readbuffer
- handler.sendbuffer = _sendbuffer
end
+
+ handler.readbuffer = _readbuffer
+ handler.sendbuffer = _sendbuffer
send = socket.send
receive = socket.receive
shutdown = ( ssl and id ) or socket.shutdown
_socketlist[ socket ] = handler
_readlistlen = addsocket(_readlist, socket, _readlistlen)
+
+ if sslctx and luasec then
+ out_put "server.lua: auto-starting ssl negotiation..."
+ handler.autostart_ssl = true;
+ handler:starttls(sslctx);
+ end
+
return handler, socket
end