mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
Fix: Jade connect() crashes due to incorrect async protocol handling (#2578)
This commit is contained in:
parent
248bed824f
commit
5101e4e317
1 changed files with 6 additions and 5 deletions
|
|
@ -43,15 +43,16 @@ class JadeTCPImpl:
|
|||
self.tcp_sock.connect((url[0], int(url[1])))
|
||||
assert self.tcp_sock is not None
|
||||
|
||||
self.tcp_sock.__enter__()
|
||||
logger.info("Connected")
|
||||
|
||||
def disconnect(self):
|
||||
assert self.tcp_sock is not None
|
||||
self.tcp_sock.__exit__()
|
||||
|
||||
# Reset state
|
||||
self.tcp_sock = None
|
||||
try:
|
||||
self.tcp_sock.close()
|
||||
except Exception as e:
|
||||
logger.warning("Error during disconnect: {}".format(str(e)))
|
||||
finally:
|
||||
self.tcp_sock = None
|
||||
|
||||
def write(self, bytes_):
|
||||
assert self.tcp_sock is not None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue