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>
This commit is contained in:
parent
e86c9421ef
commit
c862c03485
13
lib/tls.js
13
lib/tls.js
@ -510,16 +510,11 @@ CryptoStream.prototype._read = function read(size) {
|
|||||||
if (this.ondata) {
|
if (this.ondata) {
|
||||||
this.ondata(pool, start, start + bytesRead);
|
this.ondata(pool, start, start + bytesRead);
|
||||||
|
|
||||||
// Deceive streams2
|
// Force state.reading to set to false
|
||||||
var self = this;
|
this.push('');
|
||||||
|
|
||||||
setImmediate(function() {
|
// Try reading more, we most likely have some data
|
||||||
// Force state.reading to set to false
|
this.read(0);
|
||||||
self.push('');
|
|
||||||
|
|
||||||
// Try reading more, we most likely have some data
|
|
||||||
self.read(0);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.push(pool.slice(start, start + bytesRead));
|
this.push(pool.slice(start, start + bytesRead));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user