Diff

net/server_event.lua @ 3001:fa00c6f563b4

net.server_select, net.server_event: Rename :pattern() method to :set_mode() for select backend, and add :set_mode() to event backend
author Matthew Wild <mwild1@gmail.com>
date Wed, 05 May 2010 15:23:17 +0100
parent 3000:43a4cb707fe4
child 3002:d1f864ed44c0
line wrap: on
line diff
--- a/net/server_event.lua	Wed May 05 15:21:17 2010 +0100
+++ b/net/server_event.lua	Wed May 05 15:23:17 2010 +0100
@@ -402,6 +402,13 @@
 			self.starttls = false; -- prevent starttls()
 		end
 	end
+
+	function interface_mt:set_mode(pattern)
+		if pattern then
+			self._pattern = pattern;
+		end
+		return self._pattern;
+	end
 	
 	function interface_mt:set_send(new_send)
 		-- No-op, we always use the underlying connection's send
@@ -599,7 +606,7 @@
 						interface.eventreadtimeout = nil
 					end
 				end
-				local buffer, err, part = interface.conn:receive( pattern )  -- receive buffer with "pattern"
+				local buffer, err, part = interface.conn:receive( interface._pattern )  -- receive buffer with "pattern"
 				--vdebug( "read data:", tostring(buffer), "error:", tostring(err), "part:", tostring(part) )
 				buffer = buffer or part or ""
 				local len = string_len( buffer )