|
@ -362,15 +362,20 @@ class DeviceMgr(ThreadJob, PrintError): |
|
|
if not xpub in self.xpub_ids: |
|
|
if not xpub in self.xpub_ids: |
|
|
return |
|
|
return |
|
|
_id = self.xpub_ids.pop(xpub) |
|
|
_id = self.xpub_ids.pop(xpub) |
|
|
client = self.client_lookup(_id) |
|
|
self._close_client(_id) |
|
|
self.clients.pop(client, None) |
|
|
|
|
|
if client: |
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
|
|
|
|
def unpair_id(self, id_): |
|
|
def unpair_id(self, id_): |
|
|
xpub = self.xpub_by_id(id_) |
|
|
xpub = self.xpub_by_id(id_) |
|
|
if xpub: |
|
|
if xpub: |
|
|
self.unpair_xpub(xpub) |
|
|
self.unpair_xpub(xpub) |
|
|
|
|
|
else: |
|
|
|
|
|
self._close_client(id_) |
|
|
|
|
|
|
|
|
|
|
|
def _close_client(self, id_): |
|
|
|
|
|
client = self.client_lookup(id_) |
|
|
|
|
|
self.clients.pop(client, None) |
|
|
|
|
|
if client: |
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
|
def pair_xpub(self, xpub, id_): |
|
|
def pair_xpub(self, xpub, id_): |
|
|
with self.lock: |
|
|
with self.lock: |
|
|