Changeset

6788:d64c1f3c7e2e

portmanager: Add forward declarations
author Kim Alvefur <zash@zash.se>
date Wed, 08 Apr 2015 00:45:26 +0200
parents 6787:ad64e2eacd0e
children 6789:6b180e77c97a
files core/portmanager.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/portmanager.lua	Wed Apr 08 00:44:30 2015 +0200
+++ b/core/portmanager.lua	Wed Apr 08 00:45:26 2015 +0200
@@ -142,6 +142,8 @@
 	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 @@
 	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 @@
 	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