Diff

net/server_event.lua @ 2534:1f46a9d9b16a

net.server_event: Support :setlistener() method on connections to work with port multiplexing
author Matthew Wild <mwild1@gmail.com>
date Fri, 29 Jan 2010 16:46:28 +0000
parent 2478:7be72eca5666
child 2535:75bb31b6c53f
line wrap: on
line diff
--- a/net/server_event.lua	Fri Jan 29 21:15:33 2010 +0500
+++ b/net/server_event.lua	Fri Jan 29 16:46:28 2010 +0000
@@ -426,6 +426,11 @@
 		return false, "setoption not implemented";
 	end
 	
+	function interface_mt:setlistener(listener)
+		self.onconnect, self.ondisconnect, self.onincoming, self.ontimeout
+			= listener.onconnect, listener.ondisconnect, listener.onincoming, listener.ontimeout;
+	end
+	
 	-- Stub handlers
 	function interface_mt:onconnect()
 	end