Comparison

plugins/s2s/s2sout.lib.lua @ 4611:8572373fa26f

mod_s2s/s2sout.lib: Log message instead of traceback when s2s isn't configured for any ports
author Matthew Wild <mwild1@gmail.com>
date Wed, 14 Mar 2012 21:43:46 +0000
parent 4602:ba898af15de5
child 4629:bdafc3e729db
comparison
equal deleted inserted replaced
4610:171051f9dd00 4611:8572373fa26f
314 314
315 module:hook_global("service-added", function (event) 315 module:hook_global("service-added", function (event)
316 if event.name ~= "s2s" then return end 316 if event.name ~= "s2s" then return end
317 317
318 local s2s_sources = portmanager.get_active_services():get("s2s"); 318 local s2s_sources = portmanager.get_active_services():get("s2s");
319 319 if not s2s_sources then
320 module:log("warn", "s2s not listening on any ports, outgoing connections may fail");
321 return;
322 end
320 for source, _ in pairs(s2s_sources) do 323 for source, _ in pairs(s2s_sources) do
321 if source == "*" or source == "0.0.0.0" then 324 if source == "*" or source == "0.0.0.0" then
322 if not socket.local_addresses then 325 if not socket.local_addresses then
323 sources[#sources + 1] = new_ip("0.0.0.0", "IPv4"); 326 sources[#sources + 1] = new_ip("0.0.0.0", "IPv4");
324 else 327 else