don't reconnect to ourself

When we discover that a connection target address leads to ourself we
set the retry time to the zero time.Time value - the only special
time.Time value. We use that marker to a) suppress subsequent
connection attempts, and b) display the next retry as 'never' in
`weave status|report`.

Closes #1305.
This commit is contained in:
Matthias Radestock committed 2015-08-18 00:51:33 +01:00
1 parent bbc91c1273
commit d8e8cd6e51
3 files changed
+17 -2

No files matched your search

+5 -1
View File
@@ -197,7 +197,11 @@ func NewLocalConnectionStatusSlice(cm *ConnectionMaker) []LocalConnectionStatus
info = target.lastError.Error()
default:
state = "failed"
info = target.lastError.Error() + ", retry: " + target.tryAfter.String()
retry := "never"
if !target.tryAfter.IsZero() {
retry = target.tryAfter.String()
}
info = target.lastError.Error() + ", retry: " + retry
}
slice = append(slice, LocalConnectionStatus{address, true, state, info})
}