Browse Source

tls: fix performance issue

See https://github.com/orangemocha/node-connection-drop

I have pinpointed the performance degradation to
ac2263b77f

This change brings performance back to the orginal levels.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
v0.10.29-release
Alexis Campailla 11 years ago
committed by Fedor Indutny
parent
commit
c862c03485
  1. 13
      lib/tls.js

13
lib/tls.js

@ -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));
}

Loading…
Cancel
Save