diff options
author | Jakob Borg <jakob@nym.se> | 2014-06-16 07:40:17 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-06-16 07:40:17 +0200 |
commit | 964c903a682acdecfbcdee60b840ae74a4a24af2 (patch) | |
tree | 5b9ebe3b198fb2055249aac806abacecb080ef9b | |
parent | 21b699826dbaef5f64189d722ab8cba7b698028a (diff) |
Only keep track of version (not modified) for sent index
-rw-r--r-- | protocol/protocol.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/protocol/protocol.go b/protocol/protocol.go index ae916cd14d..56f1338a5f 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -81,7 +81,7 @@ type rawConnection struct { xw *xdr.Writer wmut sync.Mutex - indexSent map[string]map[string][2]int64 + indexSent map[string]map[string]uint64 awaiting []chan asyncResult imut sync.Mutex @@ -122,7 +122,7 @@ func NewConnection(nodeID string, reader io.Reader, writer io.Writer, receiver M wb: wb, xw: xdr.NewWriter(wb), awaiting: make([]chan asyncResult, 0x1000), - indexSent: make(map[string]map[string][2]int64), + indexSent: make(map[string]map[string]uint64), outbox: make(chan []encodable), nextID: make(chan int), closed: make(chan struct{}), @@ -149,18 +149,18 @@ func (c *rawConnection) Index(repo string, idx []FileInfo) { // This is the first time we send an index. msgType = messageTypeIndex - c.indexSent[repo] = make(map[string][2]int64) + c.indexSent[repo] = make(map[string]uint64) for _, f := range idx { - c.indexSent[repo][f.Name] = [2]int64{f.Modified, int64(f.Version)} + c.indexSent[repo][f.Name] = f.Version } } else { // We have sent one full index. Only send updates now. msgType = messageTypeIndexUpdate var diff []FileInfo for _, f := range idx { - if vs, ok := c.indexSent[repo][f.Name]; !ok || f.Modified != vs[0] || int64(f.Version) != vs[1] { + if vs, ok := c.indexSent[repo][f.Name]; !ok || f.Version != vs { diff = append(diff, f) - c.indexSent[repo][f.Name] = [2]int64{f.Modified, int64(f.Version)} + c.indexSent[repo][f.Name] = f.Version } } idx = diff |