You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using geventclient.py which subclasses WebSocketClient in threadedclient.py. The client connects and waits for a message. If the server sends a message and immediately closes the websocket, the client goes into an infinite loop. It happens in threadedclient.py in the _receive() method. Basically, there is a socket recv() command which returns "" indicating that the server has closed. But the _receive() method does not close, and calls socket recv() again. Here is the first part of the function with my patch, which fixes the problem in my limited tests.
def _receive(self):
next_size = 2
try:
self.sock.setblocking(1)
while self.running:
if self.__buffer:
bytes, self.__buffer = self.__buffer[:next_size], self.__buffer[next_size:]
else:
bytes = self.read_from_connection(next_size)
######### patch start
if bytes is None or len(bytes) == 0:
self.server_terminated = True
self.running = False
break
######### patch end
with self._lock:
s = self.stream
next_size = s.parser.send(bytes)
The text was updated successfully, but these errors were encountered:
I am using geventclient.py which subclasses WebSocketClient in threadedclient.py. The client connects and waits for a message. If the server sends a message and immediately closes the websocket, the client goes into an infinite loop. It happens in threadedclient.py in the _receive() method. Basically, there is a socket recv() command which returns "" indicating that the server has closed. But the _receive() method does not close, and calls socket recv() again. Here is the first part of the function with my patch, which fixes the problem in my limited tests.
The text was updated successfully, but these errors were encountered: