Changeset

1098:37ea264e133d

net.server: Add getserver() method to find the server listening on the specified port
author Matthew Wild <mwild1@gmail.com>
date Sun, 03 May 2009 01:09:57 +0100
parents 1097:c5b33640a5f0
children 1099:127e6ae089f8
files net/server.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Sat May 02 22:04:21 2009 +0100
+++ b/net/server.lua	Sun May 03 01:09:57 2009 +0100
@@ -77,6 +77,7 @@
 local addtimer
 local closeall
 local addserver
+local getserver
 local wrapserver
 local getsettings
 local closesocket
@@ -670,6 +671,10 @@
     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 @@
     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 @@
     closeall = closeall,
     addtimer = addtimer,
     addserver = addserver,
+    getserver = getserver,
     getsettings = getsettings,
     setquitting = setquitting,
     removeserver = removeserver,