Browse Source

Fix race conditions in test-http-upgrade-client2

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
40f675b64b
  1. 16
      test/simple/test-http-upgrade-client2.js

16
test/simple/test-http-upgrade-client2.js

@ -12,11 +12,13 @@ server.on('upgrade', function(req, socket, head) {
socket.end();
});
});
server.listen(8000);
var client = http.createClient(8000);
function upgradeRequest(fn) {
server.listen(common.PORT, function () {
var client = http.createClient(common.PORT);
function upgradeRequest(fn) {
var request = client.request('GET', '/', {
'Connection': 'Upgrade',
'Upgrade': 'Test'
@ -44,10 +46,10 @@ function upgradeRequest(fn) {
request.write('head');
}
}
successCount = 0;
upgradeRequest(function() {
successCount = 0;
upgradeRequest(function() {
successCount++;
upgradeRequest(function() {
successCount++;
@ -57,6 +59,8 @@ upgradeRequest(function() {
client.destroy();
server.close();
});
});
});
process.on('exit', function () {

Loading…
Cancel
Save