Changeset

850:edbd0d1fce93

net.server: Don't retry if client closes socket during SSL handshaking
author Matthew Wild <mwild1@gmail.com>
date Sun, 01 Mar 2009 23:33:41 +0000
parents 849:5049b4512df0
children 851:b48c7ed3f7f8
files net/server.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Sat Feb 28 23:16:27 2009 +0000
+++ b/net/server.lua	Sun Mar 01 23:33:41 2009 +0000
@@ -489,7 +489,7 @@
                     read, wrote = nil, nil
                     _, err = client:dohandshake( )
                     if not err then
-                        --out_put( "server.lua: ssl handshake done" )
+                        out_put( "server.lua: ssl handshake done" )
                         handler.readbuffer = _readbuffer    -- when handshake is done, replace the handshake function with regular functions
                         handler.sendbuffer = _sendbuffer
                         -- return dispatch( handler )
@@ -504,12 +504,14 @@
                                 _readlistlen = _readlistlen + 1
                                 _readlist [ _readlistlen ] = client
                                 read = true
+                        else
+                        	break;
                         end
                         --coroutine_yield( handler, nil, err )    -- handshake not finished
                         coroutine_yield( )
                     end
                 end
-                disconnect( handler, "max handshake attemps exceeded" )
+                disconnect( handler, "ssl handshake failed" )
                 handler.close( true )    -- forced disconnect
                 return false    -- handshake failed
             end