MCPcopy Index your code
hub / github.com/nodejs/node / onnewsession

Function onnewsession

lib/internal/tls/wrap.js:439–477  ·  view source on GitHub ↗
(sessionId, session)

Source from the content-addressed store, hash-verified

437}
438
439function onnewsession(sessionId, session) {
440 debug('onnewsession');
441 const owner = this[owner_symbol];
442
443 // TODO(@sam-github) no server to emit the event on, but handshake won't
444 // continue unless newSessionDone() is called, should it be, or is that
445 // situation unreachable, or only occurring during shutdown?
446 if (!owner.server)
447 return;
448
449 let once = false;
450 const done = () => {
451 debug('onnewsession done');
452 if (once)
453 return;
454 once = true;
455
456 if (owner._handle === null)
457 return owner.destroy(new ERR_SOCKET_CLOSED());
458
459 this.newSessionDone();
460
461 owner._newSessionPending = false;
462 if (owner._securePending)
463 owner._finishInit();
464 owner._securePending = false;
465 };
466
467 owner._newSessionPending = true;
468
469 let hasEmitted = false;
470 try {
471 hasEmitted = owner.server.emit('newSession', sessionId, session, done);
472 } catch (err) {
473 owner.server.emit('error', err);
474 }
475 if (!hasEmitted)
476 done();
477}
478
479function onPskServerCallback(identity, maxPskLen) {
480 const owner = this[owner_symbol];

Callers

nothing calls this directly

Calls 3

doneFunction · 0.70
debugFunction · 0.50
emitMethod · 0.45

Tested by

no test coverage detected