Commit 23e46494 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Document HttpServer.__init__

At the same time, simplify the interface a bit by not using a tuple.

Reviewed-by: killerfoxi, ultrotter
parent 18fb5e1d
......@@ -697,7 +697,7 @@ def main():
queue_lock = jstore.InitAndVerifyQueue(must_lock=False)
mainloop = daemon.Mainloop()
server = NodeHttpServer(mainloop, ("", port))
server = NodeHttpServer(mainloop, "", port)
server.Start()
try:
mainloop.Run()
......
......@@ -132,7 +132,7 @@ def main():
utils.WritePidFile(constants.RAPI_PID)
try:
mainloop = daemon.Mainloop()
server = RemoteApiHttpServer(mainloop, ("", options.port))
server = RemoteApiHttpServer(mainloop, "", options.port)
server.Start()
try:
mainloop.Run()
......
......@@ -456,9 +456,20 @@ class HttpServer(object):
"""
MAX_CHILDREN = 20
def __init__(self, mainloop, server_address):
def __init__(self, mainloop, local_address, port):
"""Initializes the HTTP server
@type mainloop: ganeti.daemon.Mainloop
@param mainloop: Mainloop used to poll for I/O events
@type local_addess: string
@param local_address: Local IP address to bind to
@type port: int
@param port: TCP port to listen on
"""
self.mainloop = mainloop
self.server_address = server_address
self.local_address = local_address
self.port = port
# TODO: SSL support
self.ssl_cert = None
......@@ -488,7 +499,7 @@ class HttpServer(object):
mainloop.RegisterSignal(self)
def Start(self):
self.socket.bind(self.server_address)
self.socket.bind((self.local_address, self.port))
self.socket.listen(5)
def Stop(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment