Changeset

2234:065faeb590b9

net.server_event: Fix to make ontimeout() listener callback work
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Nov 2009 22:15:40 +0000
parents 2233:459c1d1cae95
children 2235:91b9587a0210
files net/server_event.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_event.lua	Thu Nov 26 22:08:47 2009 +0000
+++ b/net/server_event.lua	Thu Nov 26 22:15:40 2009 +0000
@@ -138,7 +138,7 @@
 			local callback = function( event )
 				if EV_TIMEOUT == event then  -- timout during connection
 					self.fatalerror = "connection timeout"
-					self.listener.ontimeout( self )  -- call timeout listener
+					self:ontimeout()  -- call timeout listener
 					self:_close()
 					debug( "new connection failed. id:", self.id, "error:", self.fatalerror )
 				else
@@ -432,6 +432,7 @@
 			onconnect = listener.onconnect;  -- will be called when client disconnects
 			ondisconnect = listener.ondisconnect;  -- will be called when client disconnects
 			onincoming = listener.onincoming;  -- will be called when client sends data
+			ontimeout = listener.ontimeout; -- called when fatal socket timeout occurs
 			eventread = false, eventwrite = false, eventclose = false,
 			eventhandshake = false, eventstarthandshake = false;  -- event handler
 			eventconnect = false, eventsession = false;  -- more event handler...