Software /
code /
prosody
Comparison
core/portmanager.lua @ 4546:c686860ef410
portmanager: Pass port to friendly_error_message()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 23 Jan 2012 00:07:15 +0000 |
parent | 4542:50aca1e0bfbd |
child | 4583:6f2789939d35 |
comparison
equal
deleted
inserted
replaced
4545:c9b91ddc9c11 | 4546:c686860ef410 |
---|---|
19 -- service_name, interface (string), port (number) | 19 -- service_name, interface (string), port (number) |
20 local active_services = multitable.new(); | 20 local active_services = multitable.new(); |
21 | 21 |
22 --- Private helpers | 22 --- Private helpers |
23 | 23 |
24 local function error_to_friendly_message(service_name, err) | 24 local function error_to_friendly_message(service_name, port, err) |
25 local friendly_message = err; | 25 local friendly_message = err; |
26 if err:match(" in use") then | 26 if err:match(" in use") then |
27 -- FIXME: Use service_name here | 27 -- FIXME: Use service_name here |
28 if port == 5222 or port == 5223 or port == 5269 then | 28 if port == 5222 or port == 5223 or port == 5269 then |
29 friendly_message = "check that Prosody or another XMPP server is " | 29 friendly_message = "check that Prosody or another XMPP server is " |
88 if not service_info.multiplex and #active_services:search(nil, interface, port) > 0 then | 88 if not service_info.multiplex and #active_services:search(nil, interface, port) > 0 then |
89 log("error", "Multiple services configured to listen on the same port: %s, %s", table.concat(active_services:search(nil, interface, port), ", "), service_name); | 89 log("error", "Multiple services configured to listen on the same port: %s, %s", table.concat(active_services:search(nil, interface, port), ", "), service_name); |
90 else | 90 else |
91 local handler, err = server.addserver(interface, port, listener, mode, ssl); | 91 local handler, err = server.addserver(interface, port, listener, mode, ssl); |
92 if not handler then | 92 if not handler then |
93 log("error", "Failed to open server port %d on %s, %s", port, interface, error_to_friendly_message(service_name, err)); | 93 log("error", "Failed to open server port %d on %s, %s", port, interface, error_to_friendly_message(service_name, port, err)); |
94 else | 94 else |
95 log("debug", "Added listening service %s to [%s]:%d", service_name, interface, port); | 95 log("debug", "Added listening service %s to [%s]:%d", service_name, interface, port); |
96 active_services:add(service_name, interface, port, { | 96 active_services:add(service_name, interface, port, { |
97 server = handler; | 97 server = handler; |
98 service = service_info; | 98 service = service_info; |