From 36f263a9004dae1689050d5032e5edd8e4525502 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sun, 14 Jan 2024 13:28:41 +0100 Subject: [PATCH] Clean up the socket after connection Helps re-launching the app. --- sopass.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sopass.py b/sopass.py index d13dfc6..222b7ea 100755 --- a/sopass.py +++ b/sopass.py @@ -76,6 +76,14 @@ def main(): log.info(f'Listening on {listen_fname}') client_skt, _addrinfo = listen_skt.accept() # blocks log.info('Incoming connection') + if True or ONE_CLIENT: + # We only support one client, so we can clean up the listening socket. + # TODO: We _could_ actually support multiple clients, by connect()ing to + # the compositor multiple times. (The code is almost ready apart from + # the fact that the select loop does not expect accepting connections.) + # However, at that point this should be probably written asynchronously… + listen_skt.close() + os.unlink(listen_fname) connect_skt.connect(connect_fname) log.debug(f'Succesfully connected to {connect_fname}')