mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-07 15:23:08 +00:00
make heartbeat interval a parameter, turn all gossipsub parameters into variables
This commit is contained in:
parent
d6dfe83ebe
commit
b490d117f2
@ -14,7 +14,9 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
GossipSubID = protocol.ID("/meshsub/1.0.0")
|
GossipSubID = protocol.ID("/meshsub/1.0.0")
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
// overlay parameters
|
// overlay parameters
|
||||||
GossipSubD = 6
|
GossipSubD = 6
|
||||||
GossipSubDlo = 4
|
GossipSubDlo = 4
|
||||||
@ -23,6 +25,9 @@ const (
|
|||||||
// gossip parameters
|
// gossip parameters
|
||||||
GossipSubHistoryLength = 5
|
GossipSubHistoryLength = 5
|
||||||
GossipSubHistoryGossip = 3
|
GossipSubHistoryGossip = 3
|
||||||
|
|
||||||
|
// heartbeat interval
|
||||||
|
GossipSubHeartbeatInterval = 1 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewGossipSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) {
|
func NewGossipSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) {
|
||||||
@ -306,7 +311,7 @@ func (gs *GossipSubRouter) sendRPC(p peer.ID, out *RPC) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gs *GossipSubRouter) heartbeatTimer() {
|
func (gs *GossipSubRouter) heartbeatTimer() {
|
||||||
ticker := time.NewTicker(1 * time.Second)
|
ticker := time.NewTicker(GossipSubHeartbeatInterval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user