Skip to content

Commit 026e03c

Browse files
danbevBridgeAR
authored andcommitted
test: minor refactoring of onticketkeycallback
The motivation for this commit is to make the the onticketkeycallback function more readable. PR-URL: #24718 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 540929d commit 026e03c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/parallel/test-https-resume-after-renew.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@ const hmac = Buffer.alloc(16, 'H');
2222

2323
server._sharedCreds.context.enableTicketKeyCallback();
2424
server._sharedCreds.context.onticketkeycallback = function(name, iv, enc) {
25-
let newName, newIV;
2625
if (enc) {
27-
newName = Buffer.alloc(16, 'A');
28-
newIV = crypto.randomBytes(16);
29-
} else {
30-
// Renew
31-
return [ 2, hmac, aes ];
26+
const newName = Buffer.alloc(16, 'A');
27+
const newIV = crypto.randomBytes(16);
28+
return [ 1, hmac, aes, newName, newIV ];
3229
}
33-
34-
return [ 1, hmac, aes, newName, newIV ];
30+
// Renew
31+
return [ 2, hmac, aes ];
3532
};
3633

3734
server.listen(0, function() {

0 commit comments

Comments
 (0)