MCPcopy Create free account
hub / github.com/Snapchat/Valdi / _startSession

Function _startSession

valdi/vscode_debugger/src/targets/node/nodeLauncherBase.ts:368–397  ·  view source on GitHub ↗
(socket: net.Socket, telemetryReporter: ITelemetryReporter)

Source from the content-addressed store, hash-verified

366 }
367
368 protected async _startSession(socket: net.Socket, telemetryReporter: ITelemetryReporter) {
369 if (!this.run) {
370 return;
371 }
372
373 const { connection, cdp, targetInfo } = await this.acquireTarget(
374 socket,
375 telemetryReporter,
376 this.run.logger,
377 );
378 if (!this.run) {
379 // if we aren't running a session, discard the socket.
380 socket.destroy();
381 return;
382 }
383
384 const target = new NodeTarget(
385 this.run.pathResolver,
386 this.run.context.targetOrigin,
387 connection,
388 cdp,
389 targetInfo,
390 this.run.logger,
391 this.createLifecycle(cdp, this.run, targetInfo),
392 );
393
394 target.setParent(targetInfo.openerId ? this.targets.get(targetInfo.openerId) : undefined);
395 this.targets.add(targetInfo.targetId, target);
396 target.onDisconnect(() => this.targets.remove(targetInfo.targetId));
397 }
398
399 /**
400 * Acquires the CDP session and target info from the connecting socket.

Callers

nothing calls this directly

Calls 6

setParentMethod · 0.95
destroyMethod · 0.65
getMethod · 0.65
addMethod · 0.65
removeMethod · 0.65
createLifecycleMethod · 0.45

Tested by

no test coverage detected