Skip to content

Commit

Permalink
make gossipInterval configurable through router config
Browse files Browse the repository at this point in the history
Fixes #100
  • Loading branch information
murali-reddy committed Feb 3, 2019
1 parent d4a1108 commit 63b5378
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ var (
// ChannelSize is the buffer size used by so-called actor goroutines
// throughout mesh.
ChannelSize = 16

gossipInterval = 30 * time.Second
)

const (
tcpHeartbeat = 30 * time.Second
gossipInterval = 30 * time.Second
maxDuration = time.Duration(math.MaxInt64)
acceptMaxTokens = 100
acceptTokenDelay = 100 * time.Millisecond // [2]
Expand All @@ -37,6 +38,7 @@ type Config struct {
ProtocolMinVersion byte
PeerDiscovery bool
TrustedSubnets []*net.IPNet
gossipInterval *time.Duration
}

// Router manages communication between this peer and the rest of the mesh.
Expand Down Expand Up @@ -78,6 +80,9 @@ func NewRouter(config Config, name PeerName, nickName string, overlay Overlay, l
}
router.topologyGossip = gossip
router.acceptLimiter = newTokenBucket(acceptMaxTokens, acceptTokenDelay)
if config.gossipInterval != nil {
gossipInterval = *config.gossipInterval
}
return router, nil
}

Expand Down

0 comments on commit 63b5378

Please sign in to comment.