From 8b37e07823064dfffa1158417cbc87ee92447cdc Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 15 Sep 2014 15:05:40 +0100 Subject: [PATCH] get rid of connection attempt count tracking --- connection_maker.go | 8 +++----- types.go | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/connection_maker.go b/connection_maker.go index a2dc733d..8c259bd5 100644 --- a/connection_maker.go +++ b/connection_maker.go @@ -12,7 +12,6 @@ import ( const ( InitialInterval = 5 * time.Second MaxInterval = 10 * time.Minute - MaxAttemptCount = 100 ) const ( @@ -145,7 +144,6 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) { } if now.After(target.tryAfter) { target.attempting = true - target.attemptCount += 1 go cm.attemptConnection(address, cm.cmdLineAddress[address]) } } @@ -164,11 +162,11 @@ func (cm *ConnectionMaker) status() string { for address, target := range cm.targets { var fmtStr string if target.attempting { - fmtStr = "%s (%v attempts, trying since %v)\n" + fmtStr = "%s (trying since %v)\n" } else { - fmtStr = "%s (%v attempts, next at %v)\n" + fmtStr = "%s (next try at %v)\n" } - buf.WriteString(fmt.Sprintf(fmtStr, address, target.attemptCount, target.tryAfter)) + buf.WriteString(fmt.Sprintf(fmtStr, address, target.tryAfter)) } return buf.String() } diff --git a/types.go b/types.go index da13b0df..093fa6d9 100644 --- a/types.go +++ b/types.go @@ -172,7 +172,6 @@ type Target struct { attempting bool // are we currently attempting to connect there? tryAfter time.Time // next time to try this address tryInterval time.Duration // backoff time on next failure - attemptCount int } // UDPSender interface and implementations