Skip to content
Snippets Groups Projects
Commit 3757a5dc authored by m-guberina's avatar m-guberina
Browse files

this should fix ctrl-c not killing networking side processes not exiting in...

this should fix ctrl-c not killing networking side processes not exiting in the case connections haven't been made (they wouldn't die if sitting on a socket.connect() or socket.listen() calls)
parent a12314d1
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,11 @@ def client_receiver(args, init_command, shm_name, lock):
break
except ConnectionRefusedError:
time.sleep(0.005)
except KeyboardInterrupt:
s.close()
if args.debug_prints:
print("NETWORKING_CLIENT: caught KeyboardInterrupt, i'm out")
return
if args.debug_prints:
print("NETWORKING CLIENT_RECEIVER: connected to server")
......
......@@ -20,7 +20,13 @@ def server_sender(args, init_command, queue):
s.bind(host_addr)
if args.debug_prints:
print("NETWORKING_SERVER: server listening on", host_addr)
try:
s.listen()
except KeyboardInterrupt:
s.close()
if args.debug_prints:
print("NETWORKING_CLIENT: caught KeyboardInterrupt, i'm out")
return
comm_socket, comm_addr = s.accept()
# we're only accepting a single connection
s.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment