Skip to content

Commit

Permalink
Make internal close command non-representable in python and skill
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbuwen committed Apr 11, 2024
1 parent 8a3894b commit 6b7bf82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion skillbridge/client/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def _receive_only(self) -> str:
) from None

if not received_length_raw:
breakpoint()
raise RuntimeError("The server unexpectedly died")
received_length = int(received_length_raw)
response = b''.join(self._receive_all(received_length)).decode()
Expand All @@ -167,7 +168,7 @@ def try_repair(self) -> Exception | str:

def close(self) -> None:
if self.connected:
self.socket.sendall(b' 5close')
self.socket.sendall(b' 5$close')
self.socket.close()
self.connected = False

Expand Down
2 changes: 1 addition & 1 deletion skillbridge/server/python_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def handle_one_request(self) -> bool:

logger.debug(f"received {len(command)} bytes")

if command.startswith(b'close'):
if command.startswith(b'$close'):
logger.debug(f"client {self.client_address} disconnected")
return False
logger.debug(f"got data {command[:1000].decode()}")
Expand Down

0 comments on commit 6b7bf82

Please sign in to comment.