Diff

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
line wrap: on
line diff
--- a/net/server_event.lua	Sun Nov 22 03:14:32 2009 +0000
+++ b/net/server_event.lua	Sun Nov 22 03:20:35 2009 +0000
@@ -444,6 +444,7 @@
 			_sslctx = sslctx; -- parameters
 			_usingssl = false;  -- client is using ssl;
 		}
+		interface.id = tostring(interface):match("%x+$");
 		interface.writecallback = function( event )  -- called on write events
 			--vdebug( "new client write event, id/ip/port:", interface, ip, port )
 			if interface.nowriting or ( interface.fatalerror and ( "client to close" ~= interface.fatalerror ) ) then  -- leave this event
@@ -592,6 +593,7 @@
 			fatalerror = false; -- error message
 			nointerface = true;  -- lock/unlock parameter
 		}
+		interface.id = tostring(interface):match("%x+$");
 		interface.readcallback = function( event )  -- server handler, called on incoming connections
 			--vdebug( "server can accept, id/addr/port:", interface, addr, port )
 			if interface.fatalerror then