GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: Use countdown in test file · nodejs/node@bdb535c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http-pipeline-regr-3332.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http-pipeline-regr-3332.js‎

Copy file name to clipboard
+6-19Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,27 @@
11
'use strict';
22
require('../common');
3-
const assert = require('assert');
43
const http = require('http');
54
const net = require('net');
5+
const Countdown = require('../common/countdown');
66

77
const big = Buffer.alloc(16 * 1024, 'A');
88

99
const COUNT = 1e4;
1010

11-
let received = 0;
11+
const countdown = new Countdown(COUNT, () => {
12+
server.close();
13+
client.end();
14+
});
1215

1316
let client;
1417
const server = http.createServer(function(req, res) {
1518
res.end(big, function() {
16-
if (++received === COUNT) {
17-
server.close();
18-
client.end();
19-
}
19+
countdown.dec();
2020
});
2121
}).listen(0, function() {
2222
const req = new Array(COUNT + 1).join('GET / HTTP/1.1\r\n\r\n');
2323
client = net.connect(this.address().port, function() {
2424
client.write(req);
2525
});
26-
27-
// Just let the test terminate instead of hanging
28-
client.on('close', function() {
29-
if (received !== COUNT)
30-
server.close();
31-
});
3226
client.resume();
3327
});
34-
35-
process.on('exit', function() {
36-
// The server should pause connection on pipeline flood, but it shoul still
37-
// resume it and finish processing the requests, when its output queue will
38-
// be empty again.
39-
assert.strictEqual(received, COUNT);
40-
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.