We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c61ca53 commit 9bd9c40Copy full SHA for 9bd9c40
websocket_server/websocket_server.py
@@ -190,6 +190,10 @@ def read_bytes(self, num):
190
def read_next_message(self):
191
try:
192
b1, b2 = self.read_bytes(2)
193
+ except ConnectionResetError:
194
+ logger.info("Client closed connection.")
195
+ self.keep_alive = 0
196
+ return
197
except ValueError as e:
198
b1, b2 = 0, 0
199
@@ -198,10 +202,6 @@ def read_next_message(self):
202
masked = b2 & MASKED
203
payload_length = b2 & PAYLOAD_LEN
200
204
201
- if not b1:
- logger.info("Client closed connection.")
- self.keep_alive = 0
- return
205
if opcode == OPCODE_CLOSE_CONN:
206
logger.info("Client asked to close connection.")
207
self.keep_alive = 0
0 commit comments