git ssb

0+

cel / pull-git-remote-helper



Commit 89903ba2fa42a5bb486607c2b44b9d740697af3b

Fix handling early client disconnect on fetch

Charles Lehner committed on 2/18/2016, 9:23:44 PM
Parent: 6198d3e1ad4b68fee408f6eade0a3ec353c06a25

Files changed

index.jschanged
test/run.jschanged
index.jsView
@@ -80,12 +80,11 @@
8080
8181 // read upload request (wants list) from client
8282 var readWant = lines.wants()
8383 readWant(null, function (end, want) {
84- // client may disconnect before sending wants
85- if (end === true) cb(true)
84+ if (end === true) return // early client disconnect
8685 else if (end) cb(end)
87- else readWant(null, nextWant)
86+ else nextWant(null, want)
8887 })
8988 function nextWant(end, want) {
9089 if (end) return wantsDone(end === true ? null : end)
9190 if (want.type == 'want') {
@@ -99,9 +98,8 @@
9998 readWant(null, nextWant)
10099 }
101100
102101 function wantsDone(err) {
103- console.error('wants done', err)
104102 if (err) return cb(err)
105103 // Read upload haves (haves list).
106104 // On first obj-id that we have, ACK
107105 // If we have none, NAK.
test/run.jsView
@@ -126,9 +126,8 @@
126126 })
127127 })
128128 })
129129
130-0 &&
131130 tape('fetch when already up-to-date', function (t) {
132131 t.git('fetch', remote.full, function (msg) {
133132 t.notOk(msg, 'should not get a message here')
134133 }, function (code) {

Built with git-ssb-web