Skip to content

Commit f7be18b

Browse files
committed
mostly fixes deadlock situation with KeyboardInterupt termination
in some cases this blocked (probably race condition with _ready) it blocked the lock in send
1 parent e547d81 commit f7be18b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pyghthouse/connection/wsconnector.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ def start(self):
3939
self.ws = WebSocketApp(self.address,
4040
on_message=None if self.on_msg is None else self._handle_msg,
4141
on_open=self._ready, on_error=self._fail)
42-
self.lock.acquire()
42+
self.lock.acquire() # wait for connection to be established
4343
kwargs = {"sslopt": {"cert_reqs": CERT_NONE}} if self.ignore_ssl_cert else None
4444
Thread(target=self.ws.run_forever, kwargs=kwargs).start()
45-
self.lock.acquire() # wait for connection to be established
46-
self.lock.release()
4745

4846
def _fail(self, ws, err):
4947
self.lock.release()

0 commit comments

Comments
 (0)