summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server/process.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-28 15:37:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-30 08:43:36 +0100
commitdd3a59d3546b900dae92ab3b3eccca5a215ddf61 (patch)
tree39e3b9ace4cac5957af570c2c256e8eef8158e07 /bitbake/lib/bb/server/process.py
parent76b6cdf414ac813783646d0456865fd20d89195f (diff)
downloadpoky-dd3a59d3546b900dae92ab3b3eccca5a215ddf61.tar.gz
bitbake: process: Move socket keep alive into BitBakeProcessServerConnection
This cleans up the socket keep alive into better class structured code and adds cleanup of the open file descriptors upon shutdown. (Bitbake rev: 77fd3a3a29a569e212374b27aea742ddbaafcdd5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
-rw-r--r--bitbake/lib/bb/server/process.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 3d9077fd07..fb96804e68 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -336,12 +336,16 @@ class ServerCommunicator():
336 return 336 return
337 337
338class BitBakeProcessServerConnection(object): 338class BitBakeProcessServerConnection(object):
339 def __init__(self, ui_channel, recv, eq): 339 def __init__(self, ui_channel, recv, eq, sock):
340 self.connection = ServerCommunicator(ui_channel, recv) 340 self.connection = ServerCommunicator(ui_channel, recv)
341 self.events = eq 341 self.events = eq
342 # Save sock so it doesn't get gc'd for the life of our connection
343 self.socket_connection = sock
342 344
343 def terminate(self): 345 def terminate(self):
344 self.socket_connection.close() 346 self.socket_connection.close()
347 self.connection.connection.close()
348 self.connection.recv.close()
345 return 349 return
346 350
347class BitBakeServer(object): 351class BitBakeServer(object):
@@ -413,12 +417,10 @@ def connectProcessServer(sockname, featureset):
413 417
414 sendfds(sock, [writefd, readfd1, writefd2]) 418 sendfds(sock, [writefd, readfd1, writefd2])
415 419
416 server_connection = BitBakeProcessServerConnection(command_chan, command_chan_recv, eq) 420 server_connection = BitBakeProcessServerConnection(command_chan, command_chan_recv, eq, sock)
417 421
418 server_connection.connection.updateFeatureSet(featureset) 422 server_connection.connection.updateFeatureSet(featureset)
419 423
420 # Save sock so it doesn't get gc'd for the life of our connection
421 server_connection.socket_connection = sock
422 except: 424 except:
423 sock.close() 425 sock.close()
424 raise 426 raise