Comparison

net/server.lua @ 1535:0afc8ae01515

net.server: Don't continue with socket initialisation if SSL handshake failed, fixes nil socket traceback
author Matthew Wild <mwild1@gmail.com>
date Sun, 12 Jul 2009 15:18:53 +0100
parent 1533:8c13be7aa9f0
child 1543:d2d80c1cad6c
comparison
equal deleted inserted replaced
1533:8c13be7aa9f0 1535:0afc8ae01515
544 return nil, nil, err -- fatal error 544 return nil, nil, err -- fatal error
545 end 545 end
546 socket:settimeout( 0 ) 546 socket:settimeout( 0 )
547 handler.readbuffer = handshake 547 handler.readbuffer = handshake
548 handler.sendbuffer = handshake 548 handler.sendbuffer = handshake
549 handshake( socket ) -- do handshake 549 if not handshake( socket ) then -- do handshake
550 return nil, nil, "ssl handshake failed";
551 end
550 else 552 else
551 -- We're not automatically doing SSL, so we're not secure (yet) 553 -- We're not automatically doing SSL, so we're not secure (yet)
552 ssl = false 554 ssl = false
553 handler.starttls = function( now ) 555 handler.starttls = function( now )
554 if not now then 556 if not now then