diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-11-28 03:04:50 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-11-28 03:04:50 +0000 |
commit | 52f805163615f2f6a6013c74f4c427393805cff4 (patch) | |
tree | b0e779a384a247a86e70b42d4a5f1d11c8644256 /net/server_select.lua | |
parent | aa93f9a29b0b01cc2a61a55d3b643a7a4ea2bcfb (diff) | |
download | prosody-52f805163615f2f6a6013c74f4c427393805cff4.tar.gz prosody-52f805163615f2f6a6013c74f4c427393805cff4.zip |
net.server_select: Autostart SSL negotiation as the last part of socket setup to avoid a traceback (#262) (thanks Maranda)
Diffstat (limited to 'net/server_select.lua')
-rw-r--r-- | net/server_select.lua | 22 |
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 |