]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: server/xmlrpc: stop server on client exit
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Sat, 31 Aug 2013 22:46:06 +0000 (23:46 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 1 Sep 2013 14:51:11 +0000 (15:51 +0100)
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.

(Bitbake rev: eb6bae56f62082bf147045311154cbae4bca0f4c)

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/server/xmlrpc.py

index cca569d0e9866c5c228b46a195bb6a1cb66e0ed5..a28672c4478a8e7744ff8e615dd33e1524a204e8 100644 (file)
@@ -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)