mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-26 12:57:26 +08:00
check bitmask for peers and keep alive
This commit is contained in:
parent
c8e8d1b889
commit
b8973df266
@ -303,6 +303,17 @@ func NewBlossomSub(
|
||||
bs.h = h
|
||||
bs.signKey = privKey
|
||||
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(30 * time.Second)
|
||||
for _, b := range bs.bitmaskMap {
|
||||
if len(b.ListPeers()) < 4 {
|
||||
discoverPeers(p2pConfig, bs.ctx, logger, bs.h, routingDiscovery)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return bs
|
||||
}
|
||||
|
||||
@ -874,16 +885,7 @@ func discoverPeers(
|
||||
|
||||
discover()
|
||||
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(5 * time.Second)
|
||||
if len(h.Network().Peers()) < 6 {
|
||||
discover()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
logger.Info("completed initial peer discovery")
|
||||
logger.Info("completed peer discovery")
|
||||
}
|
||||
|
||||
func mergeDefaults(p2pConfig *config.P2PConfig) blossomsub.BlossomSubParams {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user