Commit ae9b54b013d2d66a40e22128321e90346c34ec36
Handle patched object stream ending
Charles Lehner committed on 2/19/2016, 3:27:14 AMParent: 63c93377c19466e121eaad5590e88488ac8fe5ee
Files changed
lib/pack.js | changed |
lib/pack.js | ||
---|---|---|
@@ -262,8 +262,9 @@ | ||
262 | 262 | |
263 | 263 | function patchObject(deltaB, deltaLength, srcObject, targetLength, cb) { |
264 | 264 | var readByte = deltaB.chunks(1) |
265 | 265 | var srcBuf |
266 | + var ended | |
266 | 267 | |
267 | 268 | // console.error('patching', srcObject.type, targetLength) |
268 | 269 | pull( |
269 | 270 | srcObject.read, |
@@ -277,10 +278,11 @@ | ||
277 | 278 | }) |
278 | 279 | ) |
279 | 280 | |
280 | 281 | function read(abort, cb) { |
282 | + if (ended) return cb(ended) | |
281 | 283 | readByte(null, function (end, dBuf) { |
282 | - if (end) return cb(end) | |
284 | + if (ended = end) return cb(end) | |
283 | 285 | var cmd = dBuf[0] |
284 | 286 | if (cmd & 0x80) |
285 | 287 | // skip a variable amount and then pass through a variable amount |
286 | 288 | readOffsetSize(cmd, deltaB, function (err, offset, size) { |
Built with git-ssb-web