bitbake: xmplrpc: split connect method

Current code in connect method sets up event queue, which requires
registering UI handler. This functionality may not be needed for
some operations, e.g. for server termination.

Moved functionality of setting up event queue in from 'connect'
method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class.

(Bitbake rev: 4429871da76d6bd29e023ff42740fe7daa6b40fa)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh 2016-01-05 15:45:37 +02:00 committed by Richard Purdie
parent 05b4fbc947
commit 773700dbc3
3 changed files with 6 additions and 2 deletions

View File

@ -403,6 +403,7 @@ def bitbake_main(configParams, configuration):
if not configParams.server_only: if not configParams.server_only:
try: try:
server_connection = server.establishConnection(featureset) server_connection = server.establishConnection(featureset)
server_connection.setupEventQueue()
except Exception as e: except Exception as e:
bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e))) bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e)))

View File

@ -63,6 +63,9 @@ class BitBakeBaseServerConnection():
def terminate(self): def terminate(self):
pass pass
def setupEventQueue(self):
pass
""" BitBakeBaseServer class is the common ancestor to all Bitbake servers """ BitBakeBaseServer class is the common ancestor to all Bitbake servers

View File

@ -302,7 +302,9 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
return None return None
self.transport.set_connection_token(token) self.transport.set_connection_token(token)
return self
def setupEventQueue(self):
self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo) self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo)
for event in bb.event.ui_queue: for event in bb.event.ui_queue:
self.events.queue_event(event) self.events.queue_event(event)
@ -314,8 +316,6 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
# no need to log it here, the error shall be sent to the client # no need to log it here, the error shall be sent to the client
raise BaseException(error) raise BaseException(error)
return self
def removeClient(self): def removeClient(self):
if not self.observer_only: if not self.observer_only:
self.connection.removeClient() self.connection.removeClient()