aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-03 01:09:57 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-03 01:09:57 +0100
commitc017eb23257e4ea60fb654ffe96aee963e048722 (patch)
tree9cbd72e82740bd5408abe663770c06bcc339c1fe /net
parent6026cb4616067aedb88070e2ba85fca05aeba341 (diff)
downloadprosody-c017eb23257e4ea60fb654ffe96aee963e048722.tar.gz
prosody-c017eb23257e4ea60fb654ffe96aee963e048722.zip
net.server: Add getserver() method to find the server listening on the specified port
Diffstat (limited to 'net')
-rw-r--r--net/server.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/server.lua b/net/server.lua
index 77bc2f5c..b2b19c70 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -77,6 +77,7 @@ local idfalse
local addtimer
local closeall
local addserver
+local getserver
local wrapserver
local getsettings
local closesocket
@@ -670,6 +671,10 @@ addserver = function( listeners, port, addr, pattern, sslctx, maxconnections, st
return handler
end
+getserver = function ( port )
+ return _server[ port ];
+end
+
removeserver = function( port )
local handler = _server[ port ]
if not handler then
@@ -728,7 +733,7 @@ stats = function( )
return _readtraffic, _sendtraffic, _readlistlen, _sendlistlen, _timerlistlen
end
-local dontstop = true;
+local dontstop = true; -- thinking about tomorrow, ...
setquitting = function (quit)
dontstop = not quit;
@@ -844,6 +849,7 @@ return {
closeall = closeall,
addtimer = addtimer,
addserver = addserver,
+ getserver = getserver,
getsettings = getsettings,
setquitting = setquitting,
removeserver = removeserver,