| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 307da2d commit 6347940
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,7 @@ const net = require('net'); | |||
| 26 | 26 | ||
| 27 | 27 | let tests_run = 0; | |
| 28 | 28 | ||
| 29 | - function pingPongTest(port, host, on_complete) { | ||
| 29 | + function pingPongTest(host, on_complete) { | ||
| 30 | 30 | const N = 1000; | |
| 31 | 31 | let count = 0; | |
| 32 | 32 | let sent_final_ping = false; | |
@@ -69,8 +69,8 @@ function pingPongTest(port, host, on_complete) { | |||
| 69 | 69 | }); | |
| 70 | 70 | }); | |
| 71 | 71 | ||
| 72 | - server.listen(port, host, function() { | ||
| 73 | - const client = net.createConnection(port, host); | ||
| 72 | + server.listen(0, host, function() { | ||
| 73 | + const client = net.createConnection(server.address().port, host); | ||
| 74 | 74 | ||
| 75 | 75 | client.setEncoding('utf8'); | |
| 76 | 76 | ||
@@ -110,12 +110,12 @@ function pingPongTest(port, host, on_complete) { | |||
| 110 | 110 | }); | |
| 111 | 111 | } | |
| 112 | 112 | ||
| 113 | - /* All are run at once, so run on different ports */ | ||
| 114 | - pingPongTest(common.PORT, 'localhost'); | ||
| 115 | - pingPongTest(common.PORT + 1, null); | ||
| 113 | + // All are run at once and will run on different ports. | ||
| 114 | + pingPongTest('localhost'); | ||
| 115 | + pingPongTest(null); | ||
| 116 | 116 | ||
| 117 | - // This IPv6 isn't working on Solaris | ||
| 118 | - if (!common.isSunOS) pingPongTest(common.PORT + 2, '::1'); | ||
| 117 | + // This IPv6 isn't working on Solaris. | ||
| 118 | + if (!common.isSunOS) pingPongTest('::1'); | ||
| 119 | 119 | ||
| 120 | 120 | process.on('exit', function() { | |
| 121 | 121 | assert.strictEqual(tests_run, common.isSunOS ? 2 : 3); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments