-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a two-part fix: - Fix pending data notification in `OutgoingMessage` to notify server about flushed data too - Fix pause/resume behavior for the consumed socket. `resume` event is emitted on a next tick, and `socket._paused` can already be `true` at this time. Pause the socket again to avoid PAUSED error on parser. Fix: #3332 PR-URL: #3342 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
- Loading branch information
Showing
5 changed files
with
120 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const http = require('http'); | ||
const net = require('net'); | ||
|
||
const big = new Buffer(16 * 1024); | ||
big.fill('A'); | ||
|
||
const COUNT = 1e4; | ||
|
||
var received = 0; | ||
|
||
var client; | ||
const server = http.createServer(function(req, res) { | ||
res.end(big, function() { | ||
if (++received === COUNT) { | ||
server.close(); | ||
client.end(); | ||
} | ||
}); | ||
}).listen(common.PORT, function() { | ||
var req = new Array(COUNT + 1).join('GET / HTTP/1.1\r\n\r\n'); | ||
client = net.connect(common.PORT, function() { | ||
client.write(req); | ||
}); | ||
|
||
// Just let the test terminate instead of hanging | ||
client.on('close', function() { | ||
if (received !== COUNT) | ||
server.close(); | ||
}); | ||
client.resume(); | ||
}); | ||
|
||
process.on('exit', function() { | ||
// The server should pause connection on pipeline flood, but it shoul still | ||
// resume it and finish processing the requests, when its output queue will | ||
// be empty again. | ||
assert.equal(received, COUNT); | ||
}); |