diff --git a/rhodecode/lib/hooks_daemon.py b/rhodecode/lib/hooks_daemon.py --- a/rhodecode/lib/hooks_daemon.py +++ b/rhodecode/lib/hooks_daemon.py @@ -153,13 +153,9 @@ class HttpHooksCallbackDaemon(ThreadedHo # request and wastes cpu at all other times. POLL_INTERVAL = 0.01 - def get_available_port(): - family = socket.AF_INET - socktype = socket.SOCK_STREAM - host = '127.0.0.1' - - mysocket = socket.socket(family, socktype) - mysocket.bind((host, 0)) + def get_available_port(self): + mysocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + mysocket.bind(('127.0.0.1', 0)) port = mysocket.getsockname()[1] mysocket.close() del mysocket