fix teardown error

This commit is contained in:
Jack Robison 2018-06-06 17:22:52 -04:00
parent bc0da5e2d1
commit ae631f05c3
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -22,7 +22,6 @@ import datastore
import protocol
from peerfinder import DHTPeerFinder
from contact import ContactManager
from distance import Distance
from iterativefind import iterativeFind
@ -156,7 +155,7 @@ class Node(MockKademliaHelper):
def __del__(self):
log.warning("unclean shutdown of the dht node")
if self._listeningPort is not None:
if hasattr(self, "_listeningPort") and self._listeningPort is not None:
self._listeningPort.stopListening()
@defer.inlineCallbacks