summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-06-12 18:06:46 +0200
committerJakob Borg <jakob@nym.se>2014-06-12 18:07:06 +0200
commit66d4e9e5d7f99528fff4c3032499ad6318e5ab30 (patch)
tree278d5ae356aaa90d10916b881c38b8b5b6419622
parentde382e33a314b07823586c4cf7d984f6456b72fc (diff)
Prevent possible reordering of Index/IndexUpdate on send (ref #344)
-rw-r--r--protocol/protocol.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/protocol/protocol.go b/protocol/protocol.go
index 8eb6789f53..def58f385f 100644
--- a/protocol/protocol.go
+++ b/protocol/protocol.go
@@ -165,9 +165,11 @@ func (c *rawConnection) Index(repo string, idx []FileInfo) {
}
idx = diff
}
- c.imut.Unlock()
- c.send(header{0, -1, msgType}, IndexMessage{repo, idx})
+ if len(idx) > 0 {
+ c.send(header{0, -1, msgType}, IndexMessage{repo, idx})
+ }
+ c.imut.Unlock()
}
// Request returns the bytes for the specified block after fetching them from the connected peer.