mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-03 13:23:07 +00:00
Merge pull request #102 from libp2p/fix/issue-101
Add control parameter for gossipsub initial heartbeat delay
This commit is contained in:
commit
30dee56ea2
10
gossipsub.go
10
gossipsub.go
@ -27,7 +27,8 @@ var (
|
||||
GossipSubHistoryGossip = 3
|
||||
|
||||
// heartbeat interval
|
||||
GossipSubHeartbeatInterval = 1 * time.Second
|
||||
GossipSubHeartbeatInitialDelay = 100 * time.Millisecond
|
||||
GossipSubHeartbeatInterval = 1 * time.Second
|
||||
|
||||
// fanout ttl
|
||||
GossipSubFanoutTTL = 60 * time.Second
|
||||
@ -349,6 +350,13 @@ func (gs *GossipSubRouter) sendRPC(p peer.ID, out *RPC) {
|
||||
}
|
||||
|
||||
func (gs *GossipSubRouter) heartbeatTimer() {
|
||||
time.Sleep(GossipSubHeartbeatInitialDelay)
|
||||
select {
|
||||
case gs.p.eval <- gs.heartbeat:
|
||||
case <-gs.p.ctx.Done():
|
||||
return
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(GossipSubHeartbeatInterval)
|
||||
defer ticker.Stop()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user