Merge pull request #4334 from ynput/bugfix/harmony_mac_unable_change_workfile

Harmony: fix unable to change workfile on Mac
This commit is contained in:
Petr Kalis 2023-01-18 11:13:30 +01:00 committed by GitHub
commit a014a07a16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,6 +40,7 @@ class Server(threading.Thread):
# Create a TCP/IP socket
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# Bind the socket to the port
server_address = ("127.0.0.1", port)
@ -91,7 +92,13 @@ class Server(threading.Thread):
self.log.info("wait ttt")
# Receive the data in small chunks and retransmit it
request = None
header = self.connection.recv(10)
try:
header = self.connection.recv(10)
except OSError:
# could happen on MacOS
self.log.info("")
break
if len(header) == 0:
# null data received, socket is closing.
self.log.info(f"[{self.timestamp()}] Connection closing.")