Changeset

2129:fcdcdf00787c

*_listener: Update for new net.server API, specifically .listener -> .onincoming, .disconnect -> .ondisconnect
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 04:43:46 +0000
parents 2128:f107f0205793
children 2130:828e161cdfc7
files net/httpclient_listener.lua net/httpserver_listener.lua net/xmppclient_listener.lua net/xmppcomponent_listener.lua net/xmppserver_listener.lua
diffstat 5 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/net/httpclient_listener.lua	Sun Nov 22 04:42:47 2009 +0000
+++ b/net/httpclient_listener.lua	Sun Nov 22 04:43:46 2009 +0000
@@ -15,7 +15,7 @@
 
 local httpclient = { default_port = 80, default_mode = "*a" };
 
-function httpclient.listener(conn, data)
+function httpclient.onincoming(conn, data)
 	local request = requests[conn];
 
 	if not request then
@@ -28,7 +28,7 @@
 	end
 end
 
-function httpclient.disconnect(conn, err)
+function httpclient.ondisconnect(conn, err)
 	local request = requests[conn];
 	if request then
 		request:reader(nil);
--- a/net/httpserver_listener.lua	Sun Nov 22 04:42:47 2009 +0000
+++ b/net/httpserver_listener.lua	Sun Nov 22 04:43:46 2009 +0000
@@ -16,7 +16,7 @@
 
 local httpserver = { default_port = 80, default_mode = "*a" };
 
-function httpserver.listener(conn, data)
+function httpserver.onincoming(conn, data)
 	local request = requests[conn];
 
 	if not request then
@@ -34,7 +34,7 @@
 	end
 end
 
-function httpserver.disconnect(conn, err)
+function httpserver.ondisconnect(conn, err)
 	local request = requests[conn];
 	if request and not request.destroyed then
 		request.conn = nil;
--- a/net/xmppclient_listener.lua	Sun Nov 22 04:42:47 2009 +0000
+++ b/net/xmppclient_listener.lua	Sun Nov 22 04:43:46 2009 +0000
@@ -101,7 +101,7 @@
 		end
 		session.send("</stream:stream>");
 		session.conn:close();
-		xmppclient.disconnect(session.conn, (reason and (reason.text or reason.condition)) or reason or "session closed");
+		xmppclient.ondisconnect(session.conn, (reason and (reason.text or reason.condition)) or reason or "session closed");
 	end
 end
 
@@ -133,7 +133,7 @@
 	end
 end
 	
-function xmppclient.disconnect(conn, err)
+function xmppclient.ondisconnect(conn, err)
 	local session = sessions[conn];
 	if session then
 		(session.log or log)("info", "Client disconnected: %s", err);
--- a/net/xmppcomponent_listener.lua	Sun Nov 22 04:42:47 2009 +0000
+++ b/net/xmppcomponent_listener.lua	Sun Nov 22 04:43:46 2009 +0000
@@ -118,12 +118,12 @@
 		end
 		session.send("</stream:stream>");
 		session.conn.close();
-		component_listener.disconnect(session.conn, "stream error");
+		component_listener.ondisconnect(session.conn, "stream error");
 	end
 end
 
 --- Component connlistener
-function component_listener.listener(conn, data)
+function component_listener.onincoming(conn, data)
 	local session = sessions[conn];
 	if not session then
 		local _send = conn.write;
@@ -157,7 +157,7 @@
 	end
 end
 	
-function component_listener.disconnect(conn, err)
+function component_listener.ondisconnect(conn, err)
 	local session = sessions[conn];
 	if session then
 		(session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err));
--- a/net/xmppserver_listener.lua	Sun Nov 22 04:42:47 2009 +0000
+++ b/net/xmppserver_listener.lua	Sun Nov 22 04:43:46 2009 +0000
@@ -104,14 +104,14 @@
 			session.conn.close(true); -- Force FIXME: timer?
 		end
 		session.conn.close();
-		xmppserver.disconnect(session.conn, "stream error");
+		xmppserver.ondisconnect(session.conn, "stream error");
 	end
 end
 
 
 -- End of session methods --
 
-function xmppserver.listener(conn, data)
+function xmppserver.onincoming(conn, data)
 	local session = sessions[conn];
 	if not session then
 		session = s2s_new_incoming(conn);
@@ -148,7 +148,7 @@
 	end
 end
 
-function xmppserver.disconnect(conn, err)
+function xmppserver.ondisconnect(conn, err)
 	local session = sessions[conn];
 	if session then
 		if err and err ~= "closed" and session.srv_hosts then