Skip to content

Commit

Permalink
scheduler: use needDrain not drained
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Jun 6, 2014
1 parent eab9576 commit f138683
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/spdy/protocol/parser.js
Expand Up @@ -22,7 +22,6 @@ if (legacy) {
function Parser(connection) {
DuplexStream.call(this);

this.drained = true;
this.paused = false;
this.buffer = [];
this.buffered = 0;
Expand Down Expand Up @@ -80,6 +79,7 @@ Parser.prototype._write = function write(data, encoding, cb) {
// Notify caller about state (for piping)
if (this.paused) {
this.needDrain = true;
cb();
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/spdy/scheduler.js
Expand Up @@ -93,7 +93,7 @@ Scheduler.prototype.tick = function tick(cb) {
this.connection.cork();
this._corked = true;
}
if (this.connection._spdyState.parser.drained) {
if (!this.connection._spdyState.parser.needDrain) {
utils.nextTick(this._tickListener);
} else {
this.connection._spdyState.parser.once('drain', this._tickListener);
Expand Down
8 changes: 4 additions & 4 deletions test/unit/stream-test.js
Expand Up @@ -323,7 +323,7 @@ suite('A SPDY Server / Stream', function() {
test('timing out', function(done) {
var data = '';

pair.server.req.socket.setTimeout(500);
pair.server.req.socket.setTimeout(300);
pair.client.req.on('error', function() {
done();
});
Expand All @@ -333,13 +333,13 @@ suite('A SPDY Server / Stream', function() {
var data = '';
var chunks = 0;

pair.server.req.socket.setTimeout(300);
pair.server.req.socket.setTimeout(150);
setTimeout(function() {
pair.server.res.write('ok1');
setTimeout(function() {
pair.server.res.write('ok2');
}, 250);
}, 250);
}, 100);
}, 100);

pair.client.res.on('data', function(chunk) {
chunk = chunk.toString();
Expand Down

0 comments on commit f138683

Please sign in to comment.