Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
tls: fix sporadic hang and partial reads
Browse files Browse the repository at this point in the history
Do not decrement size in read loop, its used later, when comparing to
`bytesRead`.

fix #6270

NOTE: Original patch contributed by @roadrunner2
  • Loading branch information
indutny committed Sep 27, 2013
1 parent cfa03ad commit 671b5be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/tls.js
Expand Up @@ -447,10 +447,9 @@ CryptoStream.prototype._read = function read(size) {
var bytesRead = 0,
start = this._buffer.offset;
do {
var read = this._buffer.use(this.pair.ssl, out, size);
var read = this._buffer.use(this.pair.ssl, out, size - bytesRead);
if (read > 0) {
bytesRead += read;
size -= read;
}

// Handle and report errors
Expand Down

0 comments on commit 671b5be

Please sign in to comment.