From e73024f2bc3b932c2a9fd87935e3c72a83c93635 Mon Sep 17 00:00:00 2001 From: MOHAN KUMAR R Date: Mon, 9 Dec 2024 21:59:36 +0530 Subject: [PATCH] Re-register proxy on local address change event from libp2p host - Subscribe to local address update events from libp2p host - On address change, shut down the existing mDNS server and re-register with updated address --- p2p/discovery/mdns/mdns.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/p2p/discovery/mdns/mdns.go b/p2p/discovery/mdns/mdns.go index b9042cfe8a..5945e5e65d 100644 --- a/p2p/discovery/mdns/mdns.go +++ b/p2p/discovery/mdns/mdns.go @@ -80,7 +80,11 @@ func (s *mdnsService) Start() error { return err } go func() { - defer ipEvt.Close() + defer func() { + if err := ipEvt.Close(); err != nil { + log.Errorf("failed to close ipEvt: %s", err) + } + }() var addrUpdateDebounce sync.Once for { select {