From 127b0c33320ced120c33efd84b2c1cb6ef126e27 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 16 Jun 2015 08:30:15 +0200 Subject: [PATCH] Add version to LocalIndexUpdate event. Allows correlating LocalIndexUpdate events on one device with RemoteIndexUpdated on another to make sure the cluster has converged. --- internal/model/model.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/model/model.go b/internal/model/model.go index a8971709f..006e0d0c0 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -1123,8 +1123,10 @@ func sendIndexTo(initial bool, minLocalVer int64, conn protocol.Connection, fold func (m *Model) updateLocals(folder string, fs []protocol.FileInfo) { m.fmut.RLock() - m.folderFiles[folder].Update(protocol.LocalDeviceID, fs) + files := m.folderFiles[folder] m.fmut.RUnlock() + files.Update(protocol.LocalDeviceID, fs) + m.rvmut.Lock() for _, f := range fs { delete(m.reqValidationCache, folder+"/"+f.Name) @@ -1132,8 +1134,9 @@ func (m *Model) updateLocals(folder string, fs []protocol.FileInfo) { m.rvmut.Unlock() events.Default.Log(events.LocalIndexUpdated, map[string]interface{}{ - "folder": folder, - "items": len(fs), + "folder": folder, + "items": len(fs), + "version": files.LocalVersion(protocol.LocalDeviceID), }) }