Comparison

net/server_event.lua @ 2112:8d70ca2d4f9e

net.server_event: Define id property for connection objects, to aid logging
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 03:20:35 +0000
parent 2111:f59d9738437e
child 2113:cbf7241a0f6a
comparison
equal deleted inserted replaced
2111:f59d9738437e 2112:8d70ca2d4f9e
442 -- Properties 442 -- Properties
443 _ip = ip, _port = port, _server = server, _pattern = pattern, 443 _ip = ip, _port = port, _server = server, _pattern = pattern,
444 _sslctx = sslctx; -- parameters 444 _sslctx = sslctx; -- parameters
445 _usingssl = false; -- client is using ssl; 445 _usingssl = false; -- client is using ssl;
446 } 446 }
447 interface.id = tostring(interface):match("%x+$");
447 interface.writecallback = function( event ) -- called on write events 448 interface.writecallback = function( event ) -- called on write events
448 --vdebug( "new client write event, id/ip/port:", interface, ip, port ) 449 --vdebug( "new client write event, id/ip/port:", interface, ip, port )
449 if interface.nowriting or ( interface.fatalerror and ( "client to close" ~= interface.fatalerror ) ) then -- leave this event 450 if interface.nowriting or ( interface.fatalerror and ( "client to close" ~= interface.fatalerror ) ) then -- leave this event
450 --vdebug( "leaving this event because:", interface.nowriting or interface.fatalerror ) 451 --vdebug( "leaving this event because:", interface.nowriting or interface.fatalerror )
451 interface.eventwrite = false 452 interface.eventwrite = false
590 eventclose = false; -- close event handler 591 eventclose = false; -- close event handler
591 readcallback = false; -- read event callback 592 readcallback = false; -- read event callback
592 fatalerror = false; -- error message 593 fatalerror = false; -- error message
593 nointerface = true; -- lock/unlock parameter 594 nointerface = true; -- lock/unlock parameter
594 } 595 }
596 interface.id = tostring(interface):match("%x+$");
595 interface.readcallback = function( event ) -- server handler, called on incoming connections 597 interface.readcallback = function( event ) -- server handler, called on incoming connections
596 --vdebug( "server can accept, id/addr/port:", interface, addr, port ) 598 --vdebug( "server can accept, id/addr/port:", interface, addr, port )
597 if interface.fatalerror then 599 if interface.fatalerror then
598 --vdebug( "leaving this event because:", self.fatalerror ) 600 --vdebug( "leaving this event because:", self.fatalerror )
599 interface.eventread = nil 601 interface.eventread = nil