Changeset

2236:cf7192f48c56

net.server_event: Count the number of client connections *upwards* :)
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Nov 2009 22:19:49 +0000
parents 2235:91b9587a0210
children 2237:63fc3cb50dc8
files net/server_event.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_event.lua	Thu Nov 26 22:18:44 2009 +0000
+++ b/net/server_event.lua	Thu Nov 26 22:19:49 2009 +0000
@@ -263,7 +263,7 @@
 				_ = self.eventreadtimeout and self.eventreadtimeout:close( )
 				_ = self.ondisconnect and self:ondisconnect( self.fatalerror )  -- call ondisconnect listener (wont be the case if handshake failed on connect)
 				_ = self.conn and self.conn:close( ) -- close connection, must also be called outside of any socket registered events!
-				self._server:counter(-1);
+				_ = self._server and self._server:counter(-1);
 				self.eventread, self.eventwrite = nil, nil
 				self.eventstarthandshake, self.eventhandshake, self.eventclose = nil, nil, nil
 				self.readcallback, self.writecallback = nil, nil
@@ -283,7 +283,7 @@
 
 	function interface_mt:counter(c)
 		if c then
-			self._connections = self._connections - c
+			self._connections = self._connections + c
 		end
 		return self._connections
 	end