def start_server(servermodule, configParams, configuration, features):
server = servermodule.BitBakeServer()
+ single_use = not configParams.server_only
if configParams.bind:
(host, port) = configParams.bind.split(':')
- server.initServer((host, int(port)))
+ server.initServer((host, int(port)), single_use)
configuration.interface = [ server.serverImpl.host, server.serverImpl.port ]
else:
- server.initServer()
+ server.initServer(single_use=single_use)
configuration.interface = []
try:
class BitBakeServer(BitBakeBaseServer):
- def initServer(self):
+ def initServer(self, single_use=True):
# establish communication channels. We use bidirectional pipes for
# ui <--> server command/response pairs
# and a queue for server -> ui event notifications
# remove this when you're done with debugging
# allow_reuse_address = True
- def __init__(self, interface):
+ def __init__(self, interface, single_use=False):
"""
Constructor
"""
BaseImplServer.__init__(self)
- self.single_use = interface[1] == 0 # anonymous port, not getting reused
+ self.single_use = single_use
# Use auto port configuration
if (interface[1] == -1):
interface = (interface[0], 0)
pass
class BitBakeServer(BitBakeBaseServer):
- def initServer(self, interface = ("localhost", 0)):
+ def initServer(self, interface = ("localhost", 0), single_use = False):
self.interface = interface
- self.serverImpl = XMLRPCServer(interface)
+ self.serverImpl = XMLRPCServer(interface, single_use)
def detach(self):
daemonize.createDaemon(self.serverImpl.serve_forever, "bitbake-cookerdaemon.log")