Allow config to specify listening interfaces

Fri, 10 Apr 2009 10:49:32 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 10 Apr 2009 10:49:32 +0100
changeset 978
a9898f54b402
parent 977
6f0bdf9e4dfb
child 979
d0fd49c4339c

Allow config to specify listening interfaces

prosody file | annotate | diff | comparison | revisions
--- a/prosody	Fri Apr 10 10:38:04 2009 +0100
+++ b/prosody	Fri Apr 10 10:49:32 2009 +0100
@@ -123,7 +123,7 @@
 
 -- start listening on sockets
 function net_activate_ports(option, listener, default, conntype)
-	local ports = config.get("*", "core", option) or default;
+	local ports = config.get("*", "core", option.."_ports") or default;
 	if type(ports) == "number" then ports = {ports} end;
 	
 	if type(ports) ~= "table" then
@@ -131,17 +131,22 @@
 	else
 		for _, port in ipairs(ports) do
 			if type(port) ~= "number" then
-				log("error", "Non-numeric "..option..": "..tostring(port));
+				log("error", "Non-numeric "..option.."_ports: "..tostring(port));
 			else
-				cl.start(listener, { ssl = conntype ~= "tcp" and global_ssl_ctx, port = port, type = conntype });
+				cl.start(listener, { 
+					ssl = conntype ~= "tcp" and global_ssl_ctx,
+					port = port,
+					interface = config.get("*", "core", option.."_interface"),
+					type = conntype
+				});
 			end
 		end
 	end
 end
 
-net_activate_ports("c2s_ports", "xmppclient", {5222}, (global_ssl_ctx and "tls") or "tcp");
-net_activate_ports("s2s_ports", "xmppserver", {5269}, "tcp");
-net_activate_ports("legacy_ssl_ports", "xmppclient", {}, "ssl");
+net_activate_ports("c2s", "xmppclient", {5222}, (global_ssl_ctx and "tls") or "tcp");
+net_activate_ports("s2s", "xmppserver", {5269}, "tcp");
+net_activate_ports("legacy_ssl", "xmppclient", {}, "ssl");
 
 if config.get("*", "core", "console_enabled") then
 	if cl.get("console") then

mercurial