| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cef5502 commit b6d33f6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,30 +12,35 @@ const tls = require('tls'); | |||
| 12 | 12 | const fixtures = require('../common/fixtures'); | |
| 13 | 13 | let cconn = null; | |
| 14 | 14 | let sconn = null; | |
| 15 | + let read_len = 0; | ||
| 16 | + const buffer_size = 1024 * 1024; | ||
| 15 | 17 | ||
| 16 | 18 | function test() { | |
| 17 | 19 | if (cconn && sconn) { | |
| 18 | 20 | cconn.resume(); | |
| 19 | 21 | sconn.resume(); | |
| 20 | - sconn.end(Buffer.alloc(1024 * 1024)); | ||
| 21 | - cconn.end(); | ||
| 22 | + sconn.end(Buffer.alloc(buffer_size)); | ||
| 22 | 23 | } | |
| 23 | 24 | } | |
| 24 | 25 | ||
| 25 | 26 | const server = tls.createServer({ | |
| 26 | 27 | key: fixtures.readKey('agent1-key.pem'), | |
| 27 | 28 | cert: fixtures.readKey('agent1-cert.pem') | |
| 28 | - }, function(c) { | ||
| 29 | - c.on('close', function() { | ||
| 30 | - server.close(); | ||
| 31 | - }); | ||
| 29 | + }, (c) => { | ||
| 30 | + c.on('close', common.mustCall(() => server.close())); | ||
| 32 | 31 | sconn = c; | |
| 33 | 32 | test(); | |
| 34 | 33 | }).listen(0, common.mustCall(function() { | |
| 35 | 34 | tls.connect(this.address().port, { | |
| 36 | 35 | rejectUnauthorized: false | |
| 37 | 36 | }, common.mustCall(function() { | |
| 38 | 37 | cconn = this; | |
| 38 | + cconn.on('data', (d) => { | ||
| 39 | + read_len += d.length; | ||
| 40 | + if (read_len === buffer_size) { | ||
| 41 | + cconn.end(); | ||
| 42 | + } | ||
| 43 | + }); | ||
| 39 | 44 | test(); | |
| 40 | 45 | })); | |
| 41 | 46 | })); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments