| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 46c1d99 commit 24d08fe
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | const common = require('../common'); | |
| 24 | + const Countdown = require('../common/countdown'); | ||
| 24 | 25 | ||
| 25 | 26 | // Make sure that throwing in 'end' handler doesn't lock | |
| 26 | 27 | // up the socket forever. | |
@@ -29,10 +30,10 @@ const common = require('../common'); | |||
| 29 | 30 | // the same, we should not be so brittle and easily broken. | |
| 30 | 31 | ||
| 31 | 32 | const http = require('http'); | |
| 33 | + const countdown = new Countdown(10, () => server.close()); | ||
| 32 | 34 | ||
| 33 | - let n = 0; | ||
| 34 | 35 | const server = http.createServer((req, res) => { | |
| 35 | - if (++n === 10) server.close(); | ||
| 36 | + countdown.dec(); | ||
| 36 | 37 | res.end('ok'); | |
| 37 | 38 | }); | |
| 38 | 39 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments