-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: refactor parallel/test-tls-delayed-attach #19421
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ const common = require('../common'); | |
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
// Checks tls delay | ||
|
||
const fixtures = require('../common/fixtures'); | ||
const assert = require('assert'); | ||
const tls = require('tls'); | ||
|
@@ -37,30 +39,30 @@ const options = { | |
cert: fixtures.readKey('agent1-cert.pem') | ||
}; | ||
|
||
const server = net.createServer(function(c) { | ||
const server = net.createServer(common.mustCall((c) => { | ||
setTimeout(function() { | ||
const s = new tls.TLSSocket(c, { | ||
isServer: true, | ||
secureContext: tls.createSecureContext(options) | ||
}); | ||
|
||
s.on('data', function(chunk) { | ||
s.on('data', common.mustCall((chunk) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be wrapped in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so should I remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @richardlau There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
IMO, yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes made :) |
||
received += chunk; | ||
}); | ||
})); | ||
|
||
s.on('end', function() { | ||
s.on('end', common.mustCall(() => { | ||
server.close(); | ||
s.destroy(); | ||
}); | ||
})); | ||
}, 200); | ||
}).listen(0, function() { | ||
const c = tls.connect(this.address().port, { | ||
})).listen(0, common.mustCall(() => { | ||
const c = tls.connect(server.address().port, { | ||
rejectUnauthorized: false | ||
}, function() { | ||
}, () => { | ||
c.end(sent); | ||
}); | ||
}); | ||
})); | ||
|
||
process.on('exit', function() { | ||
process.on('exit', () => { | ||
assert.strictEqual(received, sent); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a more descriptive comment here? This doesn't add any information that isn't in the file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more description added