Diff

net/server_event.lua @ 4676:1ce2ff9ec313

net.server_event: Do not automatically close clients when closing a server port
author Matthew Wild <mwild1@gmail.com>
date Tue, 24 Apr 2012 15:52:30 +0100
parent 4468:938d878d8087
child 4905:274ef78aa173
line wrap: on
line diff
--- a/net/server_event.lua	Tue Apr 24 15:42:35 2012 +0100
+++ b/net/server_event.lua	Tue Apr 24 15:52:30 2012 +0100
@@ -343,24 +343,11 @@
 				return nil, "writebuffer not empty, waiting"
 			end
 		else
-			debug( "try to close server with id:", self.id, "args:", now )
+			debug( "try to close server with id:", tostring(self.id), "args:", tostring(now) )
 			self.fatalerror = "server to close"
 			self:_lock( true )
-			local count = 0
-			for _, item in ipairs( interfacelist( ) ) do
-				if ( item.type ~= "server" ) and ( item._server == self ) then  -- client/server match
-					if item:close( now ) then  -- writebuffer was empty
-						count = count + 1
-					end
-				end
-			end
-			local timeout = 0  -- dont wait for unfinished writebuffers of clients...
-			if not now then
-				timeout = cfg.WRITE_TIMEOUT  -- ...or wait for it
-			end
-			self:_close( timeout )  -- add new event to remove the server interface
-			debug( "seconds remained until server is closed:", timeout )
-			return count  -- returns finished clients with empty writebuffer
+			self:_close( 0 )  -- add new event to remove the server interface
+			return true
 		end
 	end