Skip to content

Commit

Permalink
grow buffer if chunk have great size
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiipsa committed Oct 2, 2014
1 parent 59bdce0 commit 0a1cfc6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/connection.js
Expand Up @@ -119,6 +119,9 @@ ConnectionManager.prototype._receive = function (data) {
var length;

if (this.readBufPos) {
if(this.readBuf.length < (this.readBufPos + data.length) ) {
this._growReadBuffer(this.readBufPos + data.length);
}
data.copy(this.readBuf, this.readBufPos);
this.readBufPos += data.length;
data = this.readBuf.slice(0, this.readBufPos);
Expand Down

0 comments on commit 0a1cfc6

Please sign in to comment.