Changeset

7225:a74f0b7be6bf

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 02 Mar 2016 16:34:34 +0100
parents 7220:2156aee1233e (current diff) 7224:07a4c807a94a (diff)
children 7232:db0dc08929e7
files net/server_event.lua
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_event.lua	Sun Feb 28 20:05:56 2016 +0100
+++ b/net/server_event.lua	Wed Mar 02 16:34:34 2016 +0100
@@ -238,8 +238,8 @@
 end
 
 function interface_mt:_lock(nointerface, noreading, nowriting)  -- lock or unlock this interface or events
-		self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting
-		return nointerface, noreading, nowriting
+	self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting
+	return nointerface, noreading, nowriting
 end
 
 --TODO: Deprecate
@@ -257,8 +257,9 @@
 
 function interface_mt:resume()
 	self:_lock(self.nointerface, false, self.nowriting);
-	if not self.eventread then
+		if self.readcallback and not self.eventread then
 		self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT );  -- register callback
+			return true;
 	end
 end
 
@@ -740,7 +741,7 @@
 
 local function newevent( ... )
 	return addevent( base, ... )
-	end
+end
 
 local function closeallservers ( arg )
 	for item in pairs( interfacelist ) do
@@ -752,9 +753,9 @@
 
 local function setquitting(yes)
 	if yes then
-		 -- Quit now
-		 closeallservers();
-		 base:loopexit();
+		-- Quit now
+		closeallservers();
+		base:loopexit();
 	end
 end
 
--- a/plugins/mod_c2s.lua	Sun Feb 28 20:05:56 2016 +0100
+++ b/plugins/mod_c2s.lua	Wed Mar 02 16:34:34 2016 +0100
@@ -283,6 +283,7 @@
 	if session then
 		(session.log or log)("info", "Client disconnected: %s", err or "connection closed");
 		sm_destroy_session(session, err);
+		session.conn = nil;
 		sessions[conn]  = nil;
 	end
 end