diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-12-27 21:20:09 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-12-27 21:20:09 +0000 |
commit | b97b1db2a0fb9d14bb8a61e72bfddb103e4e53cb (patch) | |
tree | 154f9c164833f7dd446a8b6c422485d436d83c98 /net/connlisteners.lua | |
parent | 89eb3c5d00a0da8a72d303e898ecfd2f63f9eb2b (diff) | |
download | prosody-b97b1db2a0fb9d14bb8a61e72bfddb103e4e53cb.tar.gz prosody-b97b1db2a0fb9d14bb8a61e72bfddb103e4e53cb.zip |
Fix specifying ports in config, and SSL support
Diffstat (limited to 'net/connlisteners.lua')
-rw-r--r-- | net/connlisteners.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/connlisteners.lua b/net/connlisteners.lua index f027dfeb..b2435f44 100644 --- a/net/connlisteners.lua +++ b/net/connlisteners.lua @@ -20,7 +20,7 @@ local listeners_dir = (CFG_SOURCEDIR or ".").."/net/"; -local server_add = require "net.server".add; +local server = require "net.server"; local log = require "util.logger".init("connlisteners"); local dofile, pcall, error = @@ -54,14 +54,19 @@ function get(name) return h; end +local wrapper_functions = { tcp = server.wraptcpclient, ssl = server.wrapsslclient, tls = server.wraptlsclient } + function start(name, udata) local h = get(name); if not h then error("No such connection module: "..name, 0); end - return server_add(h, + + local wrapper_function = wrapper_functions[(udata and udata.type)] or wrapper_functions.tcp; + + return server.add(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 ); + (udata and udata.interface) or "*", (udata and udata.mode) or h.default_mode or 1, (udata and udata.ssl) or nil, wrapper_function); end return _M; |