catch TransportNotConnected

This commit is contained in:
Jack Robison 2019-04-10 10:26:57 -04:00
parent 33a68b5cef
commit 3a53ef5690
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -5,7 +5,7 @@ from itertools import chain
import typing import typing
import logging import logging
from lbrynet.dht import constants from lbrynet.dht import constants
from lbrynet.dht.error import RemoteException from lbrynet.dht.error import RemoteException, TransportNotConnected
from lbrynet.dht.protocol.distance import Distance from lbrynet.dht.protocol.distance import Distance
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -169,7 +169,7 @@ class IterativeFinder:
log.warning(str(err)) log.warning(str(err))
self.active.discard(peer) self.active.discard(peer)
return return
except RemoteException: except (RemoteException, TransportNotConnected):
return return
return await self._handle_probe_result(peer, response) return await self._handle_probe_result(peer, response)
@ -215,7 +215,7 @@ class IterativeFinder:
await self._search_round() await self._search_round()
if self.running: if self.running:
self.delayed_calls.append(self.loop.call_later(delay, self._search)) self.delayed_calls.append(self.loop.call_later(delay, self._search))
except (asyncio.CancelledError, StopAsyncIteration): except (asyncio.CancelledError, StopAsyncIteration, TransportNotConnected):
if self.running: if self.running:
self.loop.call_soon(self.aclose) self.loop.call_soon(self.aclose)