# HG changeset patch # User Matthew Wild # Date 1322449490 0 # Node ID 8e02ba75ef06e1a0cd23a0b4600f77ebbf21f3a6 # Parent 0317b01b6bcd90237234a470dfd4ffa902454396 net.server_select: Autostart SSL negotiation as the last part of socket setup to avoid a traceback (#262) (thanks Maranda) diff -r 0317b01b6bcd -r 8e02ba75ef06 net/server_select.lua --- a/net/server_select.lua Sat Nov 26 03:50:51 2011 +0000 +++ b/net/server_select.lua Mon Nov 28 03:04:50 2011 +0000 @@ -596,25 +596,23 @@ 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 + 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