diff --git a/lib/wire/messagestream.js b/lib/wire/messagestream.js index ccd672a7..66e6cf37 100644 --- a/lib/wire/messagestream.js +++ b/lib/wire/messagestream.js @@ -58,19 +58,14 @@ util.inherits(DelimitingStream, stream.Transform) DelimitingStream.prototype._transform = function(chunk, encoding, done) { var length = chunk.length var lengthBytes = [] - var more = true - while (more) { - if (length > 0x7f) { - lengthBytes.push((1 << 7) + (length & 0x7f)) - length >>= 7 - } - else { - lengthBytes.push(length) - more = false - } + while (length > 0x7f) { + lengthBytes.push((1 << 7) + (length & 0x7f)) + length >>= 7 } + lengthBytes.push(length) + this.push(new Buffer(lengthBytes)) this.push(chunk)