Run of fresh-snapshots for golang-github-weaveworks-mesh

Try this locally (using silver-platter):

debian-svp new-upstream --snapshot golang-github-weaveworks-mesh 

Merge these changes:

Summary

Merged new upstream version: 0.2+git20190731.b7aea39 (was: 0.1+git20180323.0c91e69).

Diff

diff --git a/README.md b/README.md
index 856768f..4b23a3f 100644
--- a/README.md
+++ b/README.md
@@ -77,3 +77,12 @@ All contributions should be made as pull requests that satisfy the guidelines, b
 In addition, several mechanical checks are enforced.
 See [the lint script](/lint) for details.
 
+## <a name="help"></a>Getting Help
+
+If you have any questions about, feedback for or problems with `mesh`:
+
+- Invite yourself to the <a href="https://slack.weave.works/" target="_blank">Weave Users Slack</a>.
+- Ask a question on the [#general](https://weave-community.slack.com/messages/general/) slack channel.
+- [File an issue](https://github.com/weaveworks/mesh/issues/new).
+
+Your feedback is always welcome!
diff --git a/debian/changelog b/debian/changelog
index 5a389b2..a2b2c02 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-weaveworks-mesh (0.2+git20190731.b7aea39-1) UNRELEASED; urgency=medium
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Sun, 11 Aug 2019 00:30:57 +0000
+
 golang-github-weaveworks-mesh (0.1+git20180323.0c91e69-1) unstable; urgency=medium
 
   [ Alexandre Viau ]
diff --git a/local_peer.go b/local_peer.go
index 7e633c9..833da7b 100644
--- a/local_peer.go
+++ b/local_peer.go
@@ -136,6 +136,10 @@ func (peer *localPeer) encode(enc *gob.Encoder) {
 // ACTOR server
 
 func (peer *localPeer) actorLoop(actionChan <-chan localPeerAction) {
+	gossipInterval := defaultGossipInterval
+	if peer.router != nil {
+		gossipInterval = peer.router.gossipInterval()
+	}
 	gossipTimer := time.Tick(gossipInterval)
 	for {
 		select {
diff --git a/router.go b/router.go
index 27be495..cfc7987 100644
--- a/router.go
+++ b/router.go
@@ -17,11 +17,12 @@ var (
 	// ChannelSize is the buffer size used by so-called actor goroutines
 	// throughout mesh.
 	ChannelSize = 16
+
+	defaultGossipInterval = 30 * time.Second
 )
 
 const (
 	tcpHeartbeat     = 30 * time.Second
-	gossipInterval   = 30 * time.Second
 	maxDuration      = time.Duration(math.MaxInt64)
 	acceptMaxTokens  = 100
 	acceptTokenDelay = 100 * time.Millisecond // [2]
@@ -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.
@@ -154,7 +156,7 @@ func (router *Router) gossipChannel(channelName string) *gossipChannel {
 	if channel, found = router.gossipChannels[channelName]; found {
 		return channel
 	}
-	channel = newGossipChannel(channelName, router.Ourself, router.Routes, &surrogateGossiper{}, router.logger)
+	channel = newGossipChannel(channelName, router.Ourself, router.Routes, &surrogateGossiper{router: router}, router.logger)
 	channel.logf("created surrogate channel")
 	router.gossipChannels[channelName] = channel
 	return channel
@@ -170,6 +172,14 @@ func (router *Router) gossipChannelSet() map[*gossipChannel]struct{} {
 	return channels
 }
 
+func (router *Router) gossipInterval() time.Duration {
+	if router.Config.GossipInterval != nil {
+		return *router.Config.GossipInterval
+	} else {
+		return defaultGossipInterval
+	}
+}
+
 func (router *Router) handleGossip(tag protocolTag, payload []byte) error {
 	decoder := gob.NewDecoder(bytes.NewReader(payload))
 	var channelName string
diff --git a/status.go b/status.go
index a78cac3..1c77039 100644
--- a/status.go
+++ b/status.go
@@ -30,7 +30,7 @@ type Status struct {
 func NewStatus(router *Router) *Status {
 	return &Status{
 		Protocol:           Protocol,
-		ProtocolMinVersion: ProtocolMinVersion,
+		ProtocolMinVersion: int(router.ProtocolMinVersion),
 		ProtocolMaxVersion: ProtocolMaxVersion,
 		Encryption:         router.usingPassword(),
 		PeerDiscovery:      router.PeerDiscovery,
diff --git a/surrogate_gossiper.go b/surrogate_gossiper.go
index 89ea9e1..4ed9f28 100644
--- a/surrogate_gossiper.go
+++ b/surrogate_gossiper.go
@@ -11,6 +11,7 @@ import (
 type surrogateGossiper struct {
 	sync.Mutex
 	prevUpdates []prevUpdate
+	router      *Router
 }
 
 type prevUpdate struct {
@@ -56,6 +57,10 @@ func (s *surrogateGossiper) OnGossip(update []byte) (GossipData, error) {
 	// (this time limit is arbitrary; surrogateGossiper should pass on new gossip immediately
 	// so there should be no reason for a duplicate to show up after a long time)
 	updateTime := now()
+	gossipInterval := defaultGossipInterval
+	if s.router != nil {
+		gossipInterval = s.router.gossipInterval()
+	}
 	deleteBefore := updateTime.Add(-gossipInterval)
 	keepFrom := len(s.prevUpdates)
 	for i, p := range s.prevUpdates {
diff --git a/surrogate_gossiper_test.go b/surrogate_gossiper_test.go
index 61931b1..a4db566 100644
--- a/surrogate_gossiper_test.go
+++ b/surrogate_gossiper_test.go
@@ -37,11 +37,11 @@ func TestSurrogateGossiperOnGossip(t *testing.T) {
 	checkOnGossip(t, s, msg[1], msg[1])
 	checkOnGossip(t, s, msg[0], nil)
 	checkOnGossip(t, s, msg[1], nil)
-	myTime = myTime.Add(gossipInterval / 2) // Should not trigger cleardown
-	checkOnGossip(t, s, msg[2], msg[2])     // Only clears out old ones on new entry
+	myTime = myTime.Add(defaultGossipInterval / 2) // Should not trigger cleardown
+	checkOnGossip(t, s, msg[2], msg[2])            // Only clears out old ones on new entry
 	checkOnGossip(t, s, msg[0], nil)
 	checkOnGossip(t, s, msg[1], nil)
-	myTime = myTime.Add(gossipInterval)
+	myTime = myTime.Add(defaultGossipInterval)
 	checkOnGossip(t, s, msg[0], nil)
 	checkOnGossip(t, s, msg[3], msg[3]) // Only clears out old ones on new entry
 	checkOnGossip(t, s, msg[0], msg[0])

Full worker log Full build log