aboutsummaryrefslogtreecommitdiffstats
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
commitdb2152e88814ad5ad29533c5adb3aeba746e1c76 (patch)
tree0338d30f81066a8f579c36ddfeb612ef1f228039
parent7e20875a3b1384f974cb8202f0a3b329675b2056 (diff)
downloadprosody-db2152e88814ad5ad29533c5adb3aeba746e1c76.tar.gz
prosody-db2152e88814ad5ad29533c5adb3aeba746e1c76.zip
portmanager: Add forward declarations
-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