net.server: Don't continue with socket initialisation if SSL handshake failed, fixes nil socket traceback

Sun, 12 Jul 2009 15:18:53 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 12 Jul 2009 15:18:53 +0100
changeset 1535
0afc8ae01515
parent 1533
8c13be7aa9f0
child 1536
8214458eacc8

net.server: Don't continue with socket initialisation if SSL handshake failed, fixes nil socket traceback

net/server.lua file | annotate | diff | comparison | revisions
--- a/net/server.lua	Sun Jul 12 14:29:42 2009 +0100
+++ b/net/server.lua	Sun Jul 12 15:18:53 2009 +0100
@@ -546,7 +546,9 @@
             socket:settimeout( 0 )
             handler.readbuffer = handshake
             handler.sendbuffer = handshake
-            handshake( socket )    -- do handshake
+            if not handshake( socket ) then   -- do handshake
+                return nil, nil, "ssl handshake failed";
+            end
         else
             -- We're not automatically doing SSL, so we're not secure (yet)
             ssl = false

mercurial