mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
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>
This commit is contained in:
@@ -336,12 +336,16 @@ class ServerCommunicator():
|
|||||||
return
|
return
|
||||||
|
|
||||||
class BitBakeProcessServerConnection(object):
|
class BitBakeProcessServerConnection(object):
|
||||||
def __init__(self, ui_channel, recv, eq):
|
def __init__(self, ui_channel, recv, eq, sock):
|
||||||
self.connection = ServerCommunicator(ui_channel, recv)
|
self.connection = ServerCommunicator(ui_channel, recv)
|
||||||
self.events = eq
|
self.events = eq
|
||||||
|
# Save sock so it doesn't get gc'd for the life of our connection
|
||||||
|
self.socket_connection = sock
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self):
|
||||||
self.socket_connection.close()
|
self.socket_connection.close()
|
||||||
|
self.connection.connection.close()
|
||||||
|
self.connection.recv.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
class BitBakeServer(object):
|
class BitBakeServer(object):
|
||||||
@@ -413,12 +417,10 @@ def connectProcessServer(sockname, featureset):
|
|||||||
|
|
||||||
sendfds(sock, [writefd, readfd1, writefd2])
|
sendfds(sock, [writefd, readfd1, writefd2])
|
||||||
|
|
||||||
server_connection = BitBakeProcessServerConnection(command_chan, command_chan_recv, eq)
|
server_connection = BitBakeProcessServerConnection(command_chan, command_chan_recv, eq, sock)
|
||||||
|
|
||||||
server_connection.connection.updateFeatureSet(featureset)
|
server_connection.connection.updateFeatureSet(featureset)
|
||||||
|
|
||||||
# Save sock so it doesn't get gc'd for the life of our connection
|
|
||||||
server_connection.socket_connection = sock
|
|
||||||
except:
|
except:
|
||||||
sock.close()
|
sock.close()
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user