net.server_event: Obey nowriting/nointerface for locks in interface methods

Sun, 22 Nov 2009 04:04:04 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 22 Nov 2009 04:04:04 +0000
changeset 2119
dd1da05568e4
parent 2118
3a5ed91a9f27
child 2120
f7b589f798af

net.server_event: Obey nowriting/nointerface for locks in interface methods

net/server_event.lua file | annotate | diff | comparison | revisions
--- a/net/server_event.lua	Sun Nov 22 03:58:37 2009 +0000
+++ b/net/server_event.lua	Sun Nov 22 04:04:04 2009 +0000
@@ -290,6 +290,7 @@
 	
 	-- Public methods
 	function interface_mt:write(data)
+		if self.nowriting then return nil, "locked" end
 		vdebug( "try to send data to client, id/data:", self.id, data )
 		data = tostring( data )
 		local len = string_len( data )
@@ -308,6 +309,7 @@
 		return true
 	end
 	function interface_mt:close(now)
+		if self.nointerface then return nil, "locked"; end
 		debug( "try to close client connection with id:", self.id )
 		if self.type == "client" then
 			self.fatalerror = "client to close"

mercurial