From d2d32f26c74425f494026770aa750cc841baccf3 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 14 Mar 2014 11:09:05 +0100 Subject: [PATCH] Don't count deleted files in synced bytes (fixes #88) --- cmd/syncthing/model.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/syncthing/model.go b/cmd/syncthing/model.go index b705508a..dc8590a8 100644 --- a/cmd/syncthing/model.go +++ b/cmd/syncthing/model.go @@ -162,7 +162,9 @@ func (m *Model) ConnectionStats() map[string]ConnectionInfo { var tot int64 for _, f := range m.global { - tot += f.Size + if f.Flags&protocol.FlagDeleted == 0 { + tot += f.Size + } } var res = make(map[string]ConnectionInfo) @@ -178,7 +180,7 @@ func (m *Model) ConnectionStats() map[string]ConnectionInfo { var have int64 for _, f := range m.remote[node] { - if f.Equals(m.global[f.Name]) { + if f.Equals(m.global[f.Name]) && f.Flags&protocol.FlagDeleted == 0 { have += f.Size } } @@ -241,8 +243,10 @@ func (m *Model) InSyncSize() (files, bytes int64) { for n, f := range m.local { if gf, ok := m.global[n]; ok && f.Equals(gf) { - files++ - bytes += f.Size + if f.Flags&protocol.FlagDeleted == 0 { + files++ + bytes += f.Size + } } }