lib/discover: Add instance ID to local discovery (fixes #3278)

A random "instance ID" is generated on each start of the local discovery
service. The instance ID is included in the announcement. When we see a
new instance ID we treat is a new device and respond with an
announcement of our own. Hence devices get to know each other quickly on
restart.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3385
This commit is contained in:
Jakob Borg
2016-07-04 11:16:48 +00:00
committed by Audrius Butkevicius
parent 8d0019595f
commit 9a0e5a7c18
5 changed files with 128 additions and 16 deletions

View File

@@ -26,6 +26,7 @@ type CacheEntry struct {
when time.Time // When did we get the result
found bool // Is it a success (cacheTime applies) or a failure (negCacheTime applies)?
validUntil time.Time // Validity time, overrides normal calculation
instanceID int64 // for local discovery, the instance ID (random on each restart)
}
// A FinderService is a Finder that has background activity and must be run as