lib/model: Track puller creation times (fixes #3145)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3150
This commit is contained in:
Audrius Butkevicius
2016-05-22 10:16:09 +00:00
committed by Jakob Borg
parent 44290a66b7
commit 00be2bf18d
4 changed files with 21 additions and 3 deletions

View File

@@ -245,6 +245,18 @@ func TestSendDownloadProgressMessages(t *testing.T) {
expect(1, state1, protocol.UpdateTypeAppend, v2, []int32{1, 2}, true)
expectEmpty()
// Returns forget and append if sharedPullerState creation timer changes.
state1.available = []int32{1}
state1.availableUpdated = tick()
state1.created = tick()
p.sendDownloadProgressMessages()
expect(0, state1, protocol.UpdateTypeForget, v2, nil, false)
expect(1, state1, protocol.UpdateTypeAppend, v2, []int32{1}, true)
expectEmpty()
// Sends an empty update if new file exists, but does not have any blocks yet. (To indicate that the old blocks are no longer available)
state1.file.Version = v1
state1.available = nil