aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-04-08 00:45:26 +0200
committerKim Alvefur <zash@zash.se>2015-04-08 00:45:26 +0200
commitadb484391f938794a0d9a7913a50d88d5d2030ff (patch)
tree0338d30f81066a8f579c36ddfeb612ef1f228039 /core
parent95c212d4a302a4c5043811e052698f396c11db62 (diff)
downloadprosody-adb484391f938794a0d9a7913a50d88d5d2030ff.tar.gz
prosody-adb484391f938794a0d9a7913a50d88d5d2030ff.zip
portmanager: Add forward declarations
Diffstat (limited to 'core')
-rw-r--r--core/portmanager.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/portmanager.lua b/core/portmanager.lua
index 47ec10c7..9f95077a 100644
--- a/core/portmanager.lua
+++ b/core/portmanager.lua
@@ -142,6 +142,8 @@ local function activate(service_name)
return true;
end
+local close; -- forward declaration
+
local function deactivate(service_name, service_info)
for name, interface, port, n, active_service --luacheck: ignore 213/name 213/n
in active_services:iter(service_name or service_info and service_info.name, nil, nil, nil) do
@@ -182,7 +184,9 @@ local function unregister_service(service_name, service_info)
fire_event("service-removed", { name = service_name, service = service_info });
end
-local function close(interface, port)
+local get_service_at -- forward declaration
+
+function close(interface, port)
local service, service_server = get_service_at(interface, port);
if not service then
return false, "port-not-open";
@@ -193,7 +197,7 @@ local function close(interface, port)
return true;
end
-local function get_service_at(interface, port)
+function get_service_at(interface, port)
local data = active_services:search(nil, interface, port)[1][1];
return data.service, data.server;
end