MCPcopy Index your code
hub / github.com/microsoft/vscode-js-debug / _startSession

Function _startSession

src/targets/node/nodeLauncherBase.ts:382–424  ·  view source on GitHub ↗
(socket: net.Socket, telemetryReporter: ITelemetryReporter)

Source from the content-addressed store, hash-verified

380 }
381
382 protected async _startSession(socket: net.Socket, telemetryReporter: ITelemetryReporter) {
383 if (!this.run) {
384 return;
385 }
386
387 const { connection, cdp, targetInfo } = await this.acquireTarget(
388 socket,
389 telemetryReporter,
390 this.run.logger,
391 );
392 if (!this.run) {
393 // if we aren't running a session, discard the socket.
394 socket.destroy();
395 return;
396 }
397
398 if (targetInfo.processId === undefined) {
399 targetInfo.processId = Number(targetInfo.targetId); // old bootloaders
400 }
401
402 let livingOpenerId = targetInfo.openerId;
403 while (
404 livingOpenerId && !this.targets.get(livingOpenerId) && this.seenOpeners.has(livingOpenerId)
405 ) {
406 livingOpenerId = this.seenOpeners.get(livingOpenerId)?.openedBy;
407 }
408
409 const target = new NodeTarget(
410 this.run.params,
411 this.run.context.targetOrigin,
412 connection,
413 cdp,
414 targetInfo,
415 this.run.logger,
416 this.createLifecycle(cdp, this.run, targetInfo),
417 livingOpenerId ? this.targets.get(livingOpenerId) : undefined,
418 );
419
420 this.seenOpeners.set(targetInfo.targetId, { openedBy: targetInfo.openerId });
421 this.listenToWorkerDomain(cdp, telemetryReporter, target);
422 this.targets.add(targetInfo.targetId, target);
423 target.onDisconnect(() => this.targets.remove(targetInfo.targetId));
424 }
425
426 private async listenToWorkerDomain(
427 cdp: Cdp.Api,

Callers

nothing calls this directly

Calls 6

getMethod · 0.65
hasMethod · 0.65
setMethod · 0.65
addMethod · 0.65
createLifecycleMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected