This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta: merge node/master into node-chakracore/master
Merge 2ac7ade as of 2017-12-16 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Taylor Woll <tawoll@ntdev.microsoft.com>
- Loading branch information
Showing
47 changed files
with
642 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const PORT = common.PORT; | ||
const net = require('net'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
n: [5, 1000] | ||
}); | ||
|
||
const reqData = 'GET / HTTP/1.1\r\n' + | ||
'Upgrade: WebSocket\r\n' + | ||
'Connection: Upgrade\r\n' + | ||
'\r\n' + | ||
'WjN}|M(6'; | ||
|
||
const resData = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' + | ||
'Upgrade: WebSocket\r\n' + | ||
'Connection: Upgrade\r\n' + | ||
'\r\n\r\n'; | ||
|
||
function main({ n }) { | ||
process.env.PORT = PORT; | ||
var server = require('../fixtures/simple-http-server.js') | ||
.listen(common.PORT) | ||
.on('listening', function() { | ||
bench.start(); | ||
doBench(server.address(), n, function() { | ||
bench.end(n); | ||
server.close(); | ||
}); | ||
}) | ||
.on('upgrade', function(req, socket, upgradeHead) { | ||
socket.resume(); | ||
socket.write(resData); | ||
socket.end(); | ||
}); | ||
} | ||
|
||
function doBench(address, count, done) { | ||
if (count === 0) { | ||
done(); | ||
return; | ||
} | ||
|
||
const conn = net.createConnection(address.port); | ||
conn.write(reqData); | ||
conn.resume(); | ||
|
||
conn.on('end', function() { | ||
doBench(address, count - 1, done); | ||
}); | ||
} |
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
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
Oops, something went wrong.