Changeset

2122:dd1da05568e4

net.server_event: Obey nowriting/nointerface for locks in interface methods
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 04:04:04 +0000
parents 2121:3a5ed91a9f27
children 2123:f7b589f798af
files net/server_event.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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"