Skip to content

Commit

Permalink
Catch connection reset in websocket handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreF committed Feb 10, 2024
1 parent 4c0d9aa commit 8153db6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/paho/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4746,7 +4746,10 @@ def _do_handshake(self, extra_headers: WebSocketHeaders | None) -> None:

while True:
# read HTTP response header as lines
byte = self._socket.recv(1)
try:
byte = self._socket.recv(1)
except ConnectionResetError:
byte = b""

self._readbuffer.extend(byte)

Expand Down

0 comments on commit 8153db6

Please sign in to comment.