Comparison

net/server.lua @ 1883:6866cf298701

net.server: Call handler's status() to notify it of ssl handshake success
author Matthew Wild <mwild1@gmail.com>
date Sun, 04 Oct 2009 15:58:21 +0100
parent 1882:ad04cac04354
child 1884:6eaa440bc9fc
comparison
equal deleted inserted replaced
1882:ad04cac04354 1883:6866cf298701
298 --// private closures of the object //-- 298 --// private closures of the object //--
299 299
300 local ssl 300 local ssl
301 301
302 local dispatch = listeners.incoming or listeners.listener 302 local dispatch = listeners.incoming or listeners.listener
303 local status = listeners.status
303 local disconnect = listeners.disconnect 304 local disconnect = listeners.disconnect
304 305
305 local bufferqueue = { } -- buffer array 306 local bufferqueue = { } -- buffer array
306 local bufferqueuelen = 0 -- end of buffer array 307 local bufferqueuelen = 0 -- end of buffer array
307 308
540 _, err = client:dohandshake( ) 541 _, err = client:dohandshake( )
541 if not err then 542 if not err then
542 out_put( "server.lua: ssl handshake done" ) 543 out_put( "server.lua: ssl handshake done" )
543 handler.readbuffer = _readbuffer -- when handshake is done, replace the handshake function with regular functions 544 handler.readbuffer = _readbuffer -- when handshake is done, replace the handshake function with regular functions
544 handler.sendbuffer = _sendbuffer 545 handler.sendbuffer = _sendbuffer
545 -- return dispatch( handler ) 546 _ = status and status( handler, "ssl-handshake-complete" )
546 return true 547 return true
547 else 548 else
548 out_put( "server.lua: error during ssl handshake: ", tostring(err) ) 549 out_put( "server.lua: error during ssl handshake: ", tostring(err) )
549 if err == "wantwrite" and not wrote then 550 if err == "wantwrite" and not wrote then
550 _sendlistlen = _sendlistlen + 1 551 _sendlistlen = _sendlistlen + 1