Skip to content

Commit d2664d6

Browse files
authored
Let start wait until the connection is established
1 parent 89692c8 commit d2664d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pyghthouse/connection/wsconnector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def start(self):
4242
self.lock.acquire()
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()
4547

4648
def _fail(self, ws, err):
4749
self.lock.release()
@@ -73,4 +75,4 @@ def construct_package(self, payload_data):
7375
'PATH': ['user', self.username, 'model'],
7476
'META': {},
7577
'PAYL': payload_data
76-
}
78+
}

0 commit comments

Comments
 (0)