get rid of connection attempt count tracking
This commit is contained in:
1 parent
5b18864aec
commit
8b37e07823
2 files changed
+3
-6
No files matched your search
+3
-5
@@ -12,7 +12,6 @@ import (
|
|||||||
const (
|
const (
|
||||||
InitialInterval = 5 * time.Second
|
InitialInterval = 5 * time.Second
|
||||||
MaxInterval = 10 * time.Minute
|
MaxInterval = 10 * time.Minute
|
||||||
MaxAttemptCount = 100
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -145,7 +144,6 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
|
|||||||
}
|
}
|
||||||
if now.After(target.tryAfter) {
|
if now.After(target.tryAfter) {
|
||||||
target.attempting = true
|
target.attempting = true
|
||||||
target.attemptCount += 1
|
|
||||||
go cm.attemptConnection(address, cm.cmdLineAddress[address])
|
go cm.attemptConnection(address, cm.cmdLineAddress[address])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,11 +162,11 @@ func (cm *ConnectionMaker) status() string {
|
|||||||
for address, target := range cm.targets {
|
for address, target := range cm.targets {
|
||||||
var fmtStr string
|
var fmtStr string
|
||||||
if target.attempting {
|
if target.attempting {
|
||||||
fmtStr = "%s (%v attempts, trying since %v)\n"
|
fmtStr = "%s (trying since %v)\n"
|
||||||
} else {
|
} 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()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ type Target struct {
|
|||||||
attempting bool // are we currently attempting to connect there?
|
attempting bool // are we currently attempting to connect there?
|
||||||
tryAfter time.Time // next time to try this address
|
tryAfter time.Time // next time to try this address
|
||||||
tryInterval time.Duration // backoff time on next failure
|
tryInterval time.Duration // backoff time on next failure
|
||||||
attemptCount int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UDPSender interface and implementations
|
// UDPSender interface and implementations
|
||||||
|
|||||||
Reference in new issue
Block a user