Comparison

net/server_event.lua @ 2118:2e2e1b46cfe2

net.server_event: conn.usingssl -> conn._usingssl
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 03:53:07 +0000
parent 2117:ce42307f0938
child 2119:9fd2782d63f6
comparison
equal deleted inserted replaced
2117:ce42307f0938 2118:2e2e1b46cfe2
353 function interface_mt:ip() 353 function interface_mt:ip()
354 return self._ip 354 return self._ip
355 end 355 end
356 356
357 function interface_mt:ssl() 357 function interface_mt:ssl()
358 return self.usingssl 358 return self._usingssl
359 end 359 end
360 360
361 function interface_mt:type() 361 function interface_mt:type()
362 return self._type or "client" 362 return self._type or "client"
363 end 363 end
375 function interface_mt:starttls() 375 function interface_mt:starttls()
376 debug( "try to start ssl at client id:", self.id ) 376 debug( "try to start ssl at client id:", self.id )
377 local err 377 local err
378 if not self._sslctx then -- no ssl available 378 if not self._sslctx then -- no ssl available
379 err = "no ssl context available" 379 err = "no ssl context available"
380 elseif self.usingssl then -- startssl was already called 380 elseif self._usingssl then -- startssl was already called
381 err = "ssl already active" 381 err = "ssl already active"
382 end 382 end
383 if err then 383 if err then
384 debug( "error:", err ) 384 debug( "error:", err )
385 return nil, err 385 return nil, err
386 end 386 end
387 self.usingssl = true 387 self._usingssl = true
388 self.startsslcallback = function( ) -- we have to start the handshake outside of a read/write event 388 self.startsslcallback = function( ) -- we have to start the handshake outside of a read/write event
389 self:_start_ssl(); 389 self:_start_ssl();
390 self.eventstarthandshake = nil 390 self.eventstarthandshake = nil
391 return -1 391 return -1
392 end 392 end
458 debug( "writing failed:", interface.fatalerror ) 458 debug( "writing failed:", interface.fatalerror )
459 interface:_close() 459 interface:_close()
460 interface.eventwrite = false 460 interface.eventwrite = false
461 return -1 461 return -1
462 else -- can write :) 462 else -- can write :)
463 if interface.usingssl then -- handle luasec 463 if interface._usingssl then -- handle luasec
464 if interface.eventreadtimeout then -- we have to read first 464 if interface.eventreadtimeout then -- we have to read first
465 local ret = interface.readcallback( ) -- call readcallback 465 local ret = interface.readcallback( ) -- call readcallback
466 --vdebug( "tried to read in writecallback, result:", ret ) 466 --vdebug( "tried to read in writecallback, result:", ret )
467 end 467 end
468 if interface.eventwritetimeout then -- luasec only 468 if interface.eventwritetimeout then -- luasec only