summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-08-31 23:46:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-01 08:54:54 +0100
commiteb6bae56f62082bf147045311154cbae4bca0f4c (patch)
tree074610b391bafbf85040935764634c6b95189f63
parente08455d5f3b8e96765942b9c3b9767c30650557d (diff)
downloadbitbake-eb6bae56f62082bf147045311154cbae4bca0f4c.tar.gz
server/xmlrpc: stop server on client exit
If the server only expects a single client to connect (i.e. no bind parameter set, so there is no way for the clients to get the server port), stop the server after the first client exits. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/server/xmlrpc.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/bb/server/xmlrpc.py b/lib/bb/server/xmlrpc.py
index cca569d0e..a28672c44 100644
--- a/lib/bb/server/xmlrpc.py
+++ b/lib/bb/server/xmlrpc.py
@@ -133,6 +133,8 @@ class BitBakeServerCommands():
if self.has_client:
self.server.set_connection_token(None)
self.has_client = False
+ if self.server.single_use:
+ self.server.quit = True
# This request handler checks if the request has a "Bitbake-token" header
# field (this comes from the client side) and compares it with its internal
@@ -239,6 +241,9 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
self.commands = BitBakeServerCommands(self)
self.autoregister_all_functions(self.commands, "")
self.interface = interface
+ self.single_use = False
+ if (interface[1] == 0): # anonymous port, not getting reused
+ self.single_use = True
def addcooker(self, cooker):
BaseImplServer.addcooker(self, cooker)