MCPcopy Create free account
hub / github.com/Marus/cortex-debug / getTCPPorts

Method getTCPPorts

src/gdb.ts:476–497  ·  view source on GitHub ↗
(useParent)

Source from the content-addressed store, hash-verified

474 }
475
476 private getTCPPorts(useParent): Thenable<void> {
477 return new Promise((resolve, reject) => {
478 const startPort = 50000;
479 if (useParent) {
480 this.ports = this.args.pvtPorts = this.args.pvtParent.pvtPorts;
481 this.serverController.setPorts(this.ports);
482 if (this.args.showDevDebugOutput) {
483 this.handleMsg('log', JSON.stringify({configFromParent: this.args.pvtMyConfigFromParent}, undefined, 4) + '\n');
484 }
485 return resolve();
486 }
487 const totalPortsNeeded = this.calculatePortsNeeded();
488 const portFinderOpts = { min: startPort, max: 52000, retrieve: totalPortsNeeded, consecutive: true };
489 TcpPortScanner.findFreePorts(portFinderOpts, GDBServer.LOCALHOST).then((ports) => {
490 this.createPortsMap(ports);
491 this.serverController.setPorts(this.ports);
492 resolve();
493 }, (e) => {
494 reject(e);
495 });
496 });
497 }
498
499 private processLaunchAttachRequest(response: DebugProtocol.LaunchResponse, attach: boolean): Promise<void> {
500 return new Promise<void>((resolve) => {

Callers 1

Calls 5

handleMsgMethod · 0.95
calculatePortsNeededMethod · 0.95
createPortsMapMethod · 0.95
setPortsMethod · 0.65
findFreePortsMethod · 0.45

Tested by

no test coverage detected