aboutsummaryrefslogtreecommitdiffstats
path: root/net/connlisteners.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-17 04:45:08 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-17 04:45:08 +0000
commitc0dbcb4389fa5470c9fc7f674fc7fa698b693c02 (patch)
tree989f31c69447cb405c148c4eb3bcb067652844f0 /net/connlisteners.lua
parent5da8d030772c430bafef92bab6fa3d43767695b2 (diff)
downloadprosody-c0dbcb4389fa5470c9fc7f674fc7fa698b693c02.tar.gz
prosody-c0dbcb4389fa5470c9fc7f674fc7fa698b693c02.zip
Port to new server.lua, quite some changes, but I believe everything to be working
Diffstat (limited to 'net/connlisteners.lua')
-rw-r--r--net/connlisteners.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/connlisteners.lua b/net/connlisteners.lua
index 1230b79c..c25f3af8 100644
--- a/net/connlisteners.lua
+++ b/net/connlisteners.lua
@@ -54,19 +54,23 @@ function get(name)
return h;
end
-local wrapper_functions = { tcp = server.wraptcpclient, ssl = server.wrapsslclient, tls = server.wraptlsclient }
-
function start(name, udata)
local h, err = get(name);
if not h then
error("No such connection module: "..name.. (err and (" ("..err..")") or ""), 0);
end
- local wrapper_function = wrapper_functions[(udata and udata.type)] or wrapper_functions.tcp;
+ if udata then
+ if (udata.type == "ssl" or udata.type == "tls") and not udata.ssl then
+ error("No SSL context supplied for a "..tostring(udata.type):upper().." connection!", 0);
+ elseif udata.ssl and udata.type == "tcp" then
+ error("SSL context supplied for a TCP connection!", 0);
+ end
+ end
- return server.add(h,
+ return server.addserver(h,
(udata and udata.port) or h.default_port or error("Can't start listener "..name.." because no port was specified, and it has no default port", 0),
- (udata and udata.interface) or "*", (udata and udata.mode) or h.default_mode or 1, (udata and udata.ssl) or nil, wrapper_function);
+ (udata and udata.interface) or "*", (udata and udata.mode) or h.default_mode or 1, (udata and udata.ssl) or nil, 99999999, udata and udata.type == "ssl");
end
return _M;