License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2019-07-03 13:55:52 +02:00
parent 51fc7af06c
commit 2a350c6e82
2 changed files with 4 additions and 3 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lotus

View File

@ -20,11 +20,11 @@ type discoveryHandler struct {
} }
func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) { func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) {
log.Warning("trying peer info: ", p) log.Warnw("discovred peer", "peer", p)
ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout) ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout)
defer cancel() defer cancel()
if err := dh.host.Connect(ctx, p); err != nil { if err := dh.host.Connect(ctx, p); err != nil {
log.Warning("Failed to connect to peer found by discovery: ", err) log.Warnw("failed to connect to peer found by discovery", "error", err)
} }
} }
@ -43,7 +43,7 @@ func SetupDiscovery(mdns bool, mdnsInterval int) func(helpers.MetricsCtx, fx.Lif
} }
service, err := discovery.NewMdnsService(helpers.LifecycleCtx(mctx, lc), host, time.Duration(mdnsInterval)*time.Second, discovery.ServiceTag) service, err := discovery.NewMdnsService(helpers.LifecycleCtx(mctx, lc), host, time.Duration(mdnsInterval)*time.Second, discovery.ServiceTag)
if err != nil { if err != nil {
log.Error("mdns error: ", err) log.Errorw("mdns error", "error", err)
return nil return nil
} }
service.RegisterNotifee(handler) service.RegisterNotifee(handler)