From 31dd61128403f0af9e2482856ec95d18c85f79d5 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 22 Nov 2009 04:43:46 +0000 Subject: *_listener: Update for new net.server API, specifically .listener -> .onincoming, .disconnect -> .ondisconnect --- net/httpclient_listener.lua | 4 ++-- net/httpserver_listener.lua | 4 ++-- net/xmppclient_listener.lua | 4 ++-- net/xmppcomponent_listener.lua | 6 +++--- net/xmppserver_listener.lua | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'net') diff --git a/net/httpclient_listener.lua b/net/httpclient_listener.lua index 69b7946b..6517de44 100644 --- a/net/httpclient_listener.lua +++ b/net/httpclient_listener.lua @@ -15,7 +15,7 @@ local buffers = {}; -- Buffers of partial lines 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 @@ function httpclient.listener(conn, data) end end -function httpclient.disconnect(conn, err) +function httpclient.ondisconnect(conn, err) local request = requests[conn]; if request then request:reader(nil); diff --git a/net/httpserver_listener.lua b/net/httpserver_listener.lua index 455191fb..5a261a43 100644 --- a/net/httpserver_listener.lua +++ b/net/httpserver_listener.lua @@ -16,7 +16,7 @@ local requests = {}; -- Open requests 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 @@ function httpserver.listener(conn, data) 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; diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index 34438f3d..fc0dce2c 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -101,7 +101,7 @@ local function session_close(session, reason) end session.send(""); 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 @@ function xmppclient.onincoming(conn, data) 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); diff --git a/net/xmppcomponent_listener.lua b/net/xmppcomponent_listener.lua index c16f41a0..b353b1b3 100644 --- a/net/xmppcomponent_listener.lua +++ b/net/xmppcomponent_listener.lua @@ -118,12 +118,12 @@ local function session_close(session, reason) end session.send(""); 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 @@ function component_listener.listener(conn, data) 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)); diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index c7e02ec5..797ef183 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -104,14 +104,14 @@ local function session_close(session, reason) 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 @@ function xmppserver.status(conn, status) 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 -- cgit v1.2.3