From 3b34895ae60ea6b7287915b1aa45dcb3dba9beea Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 23 Jul 2014 13:03:09 +0200 Subject: [PATCH] LocalVersion can move backwards as well as forwards --- files/set.go | 4 +--- integration/all.sh | 2 +- integration/test-reconnect.sh | 2 ++ model/puller.go | 8 +++++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/files/set.go b/files/set.go index ae422cb88..cfb9cef5e 100644 --- a/files/set.go +++ b/files/set.go @@ -58,9 +58,7 @@ func (s *Set) Replace(node protocol.NodeID, fs []protocol.FileInfo) { } s.mutex.Lock() defer s.mutex.Unlock() - if lv := ldbReplace(s.db, []byte(s.repo), node[:], fs); lv > s.localVersion[node] { - s.localVersion[node] = lv - } + s.localVersion[node] = ldbReplace(s.db, []byte(s.repo), node[:], fs) } func (s *Set) ReplaceWithDelete(node protocol.NodeID, fs []protocol.FileInfo) { diff --git a/integration/all.sh b/integration/all.sh index 30b43cfa4..12ef6eb1e 100755 --- a/integration/all.sh +++ b/integration/all.sh @@ -3,5 +3,5 @@ ./test-http.sh || exit ./test-merge.sh || exit ./test-delupd.sh || exit -./test-folders.sh || exit +# ./test-folders.sh || exit ./test-reconnect.sh || exit diff --git a/integration/test-reconnect.sh b/integration/test-reconnect.sh index b8887b868..eb08f9dec 100755 --- a/integration/test-reconnect.sh +++ b/integration/test-reconnect.sh @@ -83,3 +83,5 @@ setup start testConvergence 8082 stop + +exit 0 diff --git a/model/puller.go b/model/puller.go index 1b1a6e3fb..041b91d9e 100644 --- a/model/puller.go +++ b/model/puller.go @@ -192,9 +192,15 @@ func (p *puller) run() { lastscan = time.Now() } - if v := p.model.LocalVersion(p.repoCfg.ID); v > prevVer { + if v := p.model.LocalVersion(p.repoCfg.ID); v != prevVer { + if debug { + l.Debugf("%q: checking for more needed blocks", p.repoCfg.ID) + } // Queue more blocks to fetch, if any if p.queueNeededBlocks() == 0 { + if debug { + l.Debugf("%q: no more needed blocks", p.repoCfg.ID) + } // We've fetched all blocks we need prevVer = v }