# HG changeset patch # User Matthew Wild # Date 1241309397 -3600 # Node ID 37ea264e133d1bda8c8a0a8434b9796af8ea30cd # Parent c5b33640a5f0c3e974c4d8ce033e0f4f42e4047e net.server: Add getserver() method to find the server listening on the specified port diff -r c5b33640a5f0 -r 37ea264e133d net/server.lua --- 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,