# HG changeset patch # User Matthew Wild # Date 1337297226 -3600 # Node ID c3e17766aead6b310b44c5785b342880465ad4ae # Parent 4dd61fe04db474ae42ac0b1c51f83310e08175ce net.server_select: Return error when SSL handshake fails immediately (thanks Zash) diff -r 4dd61fe04db4 -r c3e17766aead net/server_select.lua --- a/net/server_select.lua Thu May 17 21:25:41 2012 +0200 +++ b/net/server_select.lua Fri May 18 00:27:06 2012 +0100 @@ -550,7 +550,7 @@ out_put( "server.lua: ssl handshake error: ", tostring(err or "handshake too long") ) disconnect( handler, "ssl handshake failed" ) _ = handler and handler:close( true ) -- forced disconnect - return false -- handshake failed + return false, err -- handshake failed end ) end @@ -594,7 +594,7 @@ handler.readbuffer = handshake handler.sendbuffer = handshake - handshake( socket ) -- do handshake + return handshake( socket ) -- do handshake end end @@ -610,7 +610,10 @@ if sslctx and luasec then out_put "server.lua: auto-starting ssl negotiation..." handler.autostart_ssl = true; - handler:starttls(sslctx); + local ok, err = handler:starttls(sslctx); + if ok == false then + return nil, nil, err + end end return handler, socket