Skip to content

Commit

Permalink
tls: fix performance issue
Browse files Browse the repository at this point in the history
See https://github.com/orangemocha/node-connection-drop

I have pinpointed the performance degradation to
nodejs/node-v0.x-archive@ac2263b

This change brings performance back to the orginal levels.

Signed-off-by: Fedor Indutny <[email protected]>
  • Loading branch information
orangemocha authored and indutny committed May 23, 2014
1 parent e86c942 commit c862c03
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,16 +510,11 @@ CryptoStream.prototype._read = function read(size) {
if (this.ondata) {
this.ondata(pool, start, start + bytesRead);

// Deceive streams2
var self = this;

setImmediate(function() {
// Force state.reading to set to false
self.push('');
// Force state.reading to set to false
this.push('');

// Try reading more, we most likely have some data
self.read(0);
});
// Try reading more, we most likely have some data
this.read(0);
} else {
this.push(pool.slice(start, start + bytesRead));
}
Expand Down

0 comments on commit c862c03

Please sign in to comment.