Commit 4a9d5400daada5adb7d75ff284f609121cff1cdb
Close stream cleanly on fetch while up-to-date
Fix %ZK8LSxtNB63OwOR4/73anKV44ObqqE9aWjiRgqVLi8s=.sha256 "socket closed" errorCharles Lehner committed on 7/13/2016, 1:45:19 PM
Parent: d057f150341d53094347e3a42383c9fe8942cab6
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -70,8 +70,9 @@ | ||
70 | 70 | var commonHash |
71 | 71 | var sendPack |
72 | 72 | var wants = {} |
73 | 73 | var shallows = {} |
74 | + var aborted | |
74 | 75 | |
75 | 76 | // Packfile negotiation |
76 | 77 | return cat([ |
77 | 78 | pktLine.encode(cat([ |
@@ -83,9 +84,9 @@ | ||
83 | 84 | |
84 | 85 | // read upload request (wants list) from client |
85 | 86 | var readWant = lines.wants() |
86 | 87 | readWant(null, function (end, want) { |
87 | - if (end === true) return cb(true) // early client disconnect | |
88 | + if (end === true) return cb(aborted = true) // early client disconnect | |
88 | 89 | else if (end) cb(end) |
89 | 90 | else nextWant(null, want) |
90 | 91 | }) |
91 | 92 | function nextWant(end, want) { |
@@ -130,9 +131,9 @@ | ||
130 | 131 | }, |
131 | 132 | ])), |
132 | 133 | |
133 | 134 | function havesDone(abort, cb) { |
134 | - if (abort) return cb(abort) | |
135 | + if (abort || aborted) return cb(abort || aborted) | |
135 | 136 | // send pack file to client |
136 | 137 | if (sendPack) |
137 | 138 | return sendPack(abort, cb) |
138 | 139 | getObjects(repo, commonHash, wants, shallows, |
Built with git-ssb-web