diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 1a6544ab1..363a9cd52 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -159,6 +159,7 @@ class Node(MockKademliaHelper): yield self.safe_stop_looping_call(self._change_token_lc) if self._listeningPort is not None: yield self._listeningPort.stopListening() + self._listeningPort = None def start_listening(self): if not self._listeningPort: diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index 9bd4a6b46..365360339 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -171,6 +171,8 @@ class KademliaProtocol(protocol.DatagramProtocol): def startProtocol(self): log.info("DHT listening on UDP %s:%i", self._node.externalIP, self._node.port) + if self._listening.called: + self._listening = defer.Deferred() self._listening.callback(True) return self._ping_queue.start()