Comparing version 1.26.4 to 1.26.5
@@ -25,3 +25,2 @@ var parser = exports; | ||
this.drained = true; | ||
this.paused = false; | ||
@@ -84,2 +83,3 @@ this.buffer = []; | ||
this.needDrain = true; | ||
cb(); | ||
return false; | ||
@@ -89,4 +89,13 @@ } | ||
// We shall not do anything until we get all expected data | ||
if (this.buffered < this.waiting) return cb(); | ||
if (this.buffered < this.waiting) { | ||
if (this.needDrain) { | ||
// Mark parser as drained | ||
this.needDrain = false; | ||
this.emit('drain'); | ||
} | ||
cb(); | ||
return; | ||
} | ||
var self = this, | ||
@@ -139,28 +148,12 @@ buffer = new Buffer(this.waiting), | ||
if (self.waiting <= self.buffered) { | ||
if (sync) { | ||
utils.nextTick(function() { | ||
// Unpause right before entering new `_write()` call | ||
self.paused = false; | ||
self._write(undefined, null, cb); | ||
}); | ||
} else { | ||
if (sync) { | ||
utils.nextTick(function() { | ||
// Unpause right before entering new `_write()` call | ||
self.paused = false; | ||
self._write(undefined, null, cb); | ||
} | ||
}); | ||
} else { | ||
utils.nextTick(function() { | ||
// Unpause only before emitting `drain` | ||
self.paused = false; | ||
if (!self.needDrain) | ||
return cb(); | ||
// Mark parser as drained | ||
self.needDrain = false; | ||
self.emit('drain'); | ||
cb(); | ||
}); | ||
// Unpause right before entering new `_write()` call | ||
self.paused = false; | ||
self._write(undefined, null, cb); | ||
} | ||
@@ -167,0 +160,0 @@ }); |
@@ -96,3 +96,3 @@ var spdy = require('../spdy'); | ||
} | ||
if (this.connection._spdyState.parser.drained) { | ||
if (!this.connection._spdyState.parser.needDrain) { | ||
utils.nextTick(this._tickListener); | ||
@@ -99,0 +99,0 @@ } else { |
{ | ||
"name": "spdy", | ||
"version": "1.26.4", | ||
"version": "1.26.5", | ||
"description": "Implementation of the SPDY protocol on node.js.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -326,3 +326,3 @@ var assert = require('assert'), | ||
pair.server.req.socket.setTimeout(500); | ||
pair.server.req.socket.setTimeout(300); | ||
pair.client.req.on('error', function() { | ||
@@ -337,3 +337,3 @@ done(); | ||
pair.server.req.socket.setTimeout(300); | ||
pair.server.req.socket.setTimeout(150); | ||
setTimeout(function() { | ||
@@ -343,4 +343,4 @@ pair.server.res.write('ok1'); | ||
pair.server.res.write('ok2'); | ||
}, 250); | ||
}, 250); | ||
}, 100); | ||
}, 100); | ||
@@ -347,0 +347,0 @@ pair.client.res.on('data', function(chunk) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143541
4257