-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Labels
Description
I expect the run_forever() in threadedclient.py to return when the websocket has completely finished. However, it can return before the websocket's closed() method has returned.
The run_forver() method checks whether the terminated() method return true. However, ws4py/websocket.py terminate(), the client_terminated and server_terminated properties that terminate() checks are set to true in the beginning, before calling closed(). This means that if the closed() method takes some time (e.g., to do some cleanup), run_forver() returns before closed() has finished.
The solution would be to move the line
self.client_terminated = self.server_terminated = True
in ws4py/websocket.py to the finally block.