aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-21 22:54:55 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-21 22:54:55 +0100
commit938276d5ca8fe272ce7c1c6fafe7afc91cc0596b (patch)
tree038ca098db1390a9db1d0035403f727b4a4142cb /net
parent60b60d9c30833600635e3a695362f903c812cd36 (diff)
downloadprosody-938276d5ca8fe272ce7c1c6fafe7afc91cc0596b.tar.gz
prosody-938276d5ca8fe272ce7c1c6fafe7afc91cc0596b.zip
multiplex_listener: Remove (already ported to mod_net_multiplex)
Diffstat (limited to 'net')
-rw-r--r--net/multiplex_listener.lua50
1 files changed, 0 insertions, 50 deletions
diff --git a/net/multiplex_listener.lua b/net/multiplex_listener.lua
deleted file mode 100644
index b515ccce..00000000
--- a/net/multiplex_listener.lua
+++ /dev/null
@@ -1,50 +0,0 @@
-
-local connlisteners_register = require "net.connlisteners".register;
-local connlisteners_get = require "net.connlisteners".get;
-
-local httpserver_listener = connlisteners_get("httpserver");
-local xmppserver_listener = connlisteners_get("xmppserver");
-local xmppclient_listener = connlisteners_get("xmppclient");
-local xmppcomponent_listener = connlisteners_get("xmppcomponent");
-
-local server = { default_mode = "*a" };
-
-local buffer = {};
-
-function server.onincoming(conn, data)
- if not data then return; end
- local buf = buffer[conn];
- buffer[conn] = nil;
- buf = buf and buf..data or data;
- if buf:match("^[a-zA-Z]") then
- local listener = httpserver_listener;
- conn:setlistener(listener);
- local onconnect = listener.onconnect;
- if onconnect then onconnect(conn) end
- listener.onincoming(conn, buf);
- elseif buf:match(">") then
- local listener;
- local xmlns = buf:match("%sxmlns%s*=%s*['\"]([^'\"]*)");
- if xmlns == "jabber:server" then
- listener = xmppserver_listener;
- elseif xmlns == "jabber:component:accept" then
- listener = xmppcomponent_listener;
- else
- listener = xmppclient_listener;
- end
- conn:setlistener(listener);
- local onconnect = listener.onconnect;
- if onconnect then onconnect(conn) end
- listener.onincoming(conn, buf);
- elseif #buf > 1024 then
- conn:close();
- else
- buffer[conn] = buf;
- end
-end
-
-function server.ondisconnect(conn, err)
- buffer[conn] = nil; -- warn if no buffer?
-end
-
-connlisteners_register("multiplex", server);