pnet: add warning when we are in PNet and have no peers

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 faca4518
......@@ -190,6 +190,24 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
return err
}
n.PNetFingerpint = protec.Fingerprint()
go func() {
t := time.NewTicker(30 * time.Second)
<-t.C // swallow one tick
for {
select {
case <-t.C:
if ph := n.PeerHost; ph != nil {
if len(ph.Network().Peers()) == 0 {
log.Warning("We are in private network and have no peers.")
log.Warning("This might be configuration mistake.")
}
}
case <-n.Process().Closing():
t.Stop()
return
}
}
}()
}
peerhost, err := hostOption(ctx, n.Identity, n.Peerstore, n.Reporter,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论