aboutsummaryrefslogtreecommitdiffstats
path: root/net/connlisteners.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-29 17:54:37 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-29 17:54:37 +0000
commit4dc046b0afa381ac22982bd1d4265775832c4553 (patch)
tree808a534fe9e3bc2cfadb1ea6bb7bacea05277631 /net/connlisteners.lua
parent8fc233d7f5e6a5bee04d6b26a761ac2f9f88e57d (diff)
parent75a4fe601018e84510f1526faa9d155a9299e528 (diff)
downloadprosody-4dc046b0afa381ac22982bd1d4265775832c4553.tar.gz
prosody-4dc046b0afa381ac22982bd1d4265775832c4553.zip
Automated merge with http://waqas.ath.cx:8000/
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;