Diff

net/server_select.lua @ 3000:43a4cb707fe4

net.server_select, net.server_event: Support for :pause() and :resume() on connections
author Matthew Wild <mwild1@gmail.com>
date Wed, 05 May 2010 15:21:17 +0100
parent 2970:9b8e139eff5f
child 3001:fa00c6f563b4
line wrap: on
line diff
--- a/net/server_select.lua	Wed May 05 11:24:45 2010 +0100
+++ b/net/server_select.lua	Wed May 05 15:21:17 2010 +0100
@@ -392,6 +392,7 @@
 		maxreadlen = readlen or maxreadlen
 		return bufferlen, maxreadlen, maxsendlen
 	end
+	--TODO: Deprecate
 	handler.lock_read = function (self, switch)
 		if switch == true then
 			local tmp = _readlistlen
@@ -409,6 +410,12 @@
 		end
 		return noread
 	end
+	handler.pause = function (self)
+		return self:lock_read(true);
+	end
+	handler.resume = function (self)
+		return self:lock_read(false);
+	end
 	handler.lock = function( self, switch )
 		handler.lock_read (switch)
 		if switch == true then