mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-27 13:27:50 +08:00
pnet: add warning when we are in PNet and have no peers
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
parent
faca4518b3
commit
4ce6358bd7
18
core/core.go
18
core/core.go
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user