mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
fix: check for mDNS attribute before accessing it in BasicHost
This commit is contained in:
@ -166,13 +166,13 @@ class BasicHost(IHost):
|
|||||||
network = self.get_network()
|
network = self.get_network()
|
||||||
async with background_trio_service(network):
|
async with background_trio_service(network):
|
||||||
await network.listen(*listen_addrs)
|
await network.listen(*listen_addrs)
|
||||||
if self.mDNS is not None:
|
if hasattr(self, "mDNS") and self.mDNS is not None:
|
||||||
logger.debug("Starting mDNS Discovery")
|
logger.debug("Starting mDNS Discovery")
|
||||||
self.mDNS.start()
|
self.mDNS.start()
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
if self.mDNS is not None:
|
if hasattr(self, "mDNS") and self.mDNS is not None:
|
||||||
self.mDNS.stop()
|
self.mDNS.stop()
|
||||||
|
|
||||||
return _run()
|
return _run()
|
||||||
|
|||||||
Reference in New Issue
Block a user