From a8093c2962e2d1b2edfbc77dca5a9b7686aa2199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E5=85=89=E5=8D=8E?= Date: Thu, 28 Nov 2019 18:06:00 +0800 Subject: [PATCH] Delete died code Lotus used kad dht as discovery protocol, not mdns . --- node/modules/lp2p/discovery.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/node/modules/lp2p/discovery.go b/node/modules/lp2p/discovery.go index 0f4201c60..f281c66c7 100644 --- a/node/modules/lp2p/discovery.go +++ b/node/modules/lp2p/discovery.go @@ -6,7 +6,6 @@ import ( "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p/p2p/discovery" "go.uber.org/fx" "github.com/filecoin-project/lotus/node/modules/helpers" @@ -34,20 +33,3 @@ func DiscoveryHandler(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) host: host, } } - -func SetupDiscovery(mdns bool, mdnsInterval int) func(helpers.MetricsCtx, fx.Lifecycle, host.Host, *discoveryHandler) error { - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, handler *discoveryHandler) error { - if mdns { - if mdnsInterval == 0 { - mdnsInterval = 5 - } - service, err := discovery.NewMdnsService(helpers.LifecycleCtx(mctx, lc), host, time.Duration(mdnsInterval)*time.Second, discovery.ServiceTag) - if err != nil { - log.Errorw("mdns error", "error", err) - return nil - } - service.RegisterNotifee(handler) - } - return nil - } -}