Skip to content

Commit

Permalink
ADD: open RPC tunnel only for single/specific service
Browse files Browse the repository at this point in the history
  • Loading branch information
gbayasgalan committed Oct 18, 2024
1 parent c167712 commit a3d2b0c
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions launcher/src/backend/Monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -1990,13 +1990,28 @@ export class Monitoring {
// Open the tunnel
try {
var localPort = localPorts.shift();
await this.nodeConnection.openTunnels([
{
dstHost: addr,
dstPort: port,
localPort: localPort,
},
]);
if (args !== undefined && args === rpcstatus.data[i].sid) {
await this.nodeConnection.openTunnels([
{
dstHost: addr,
dstPort: port,
localPort: localPort,
},
]);
// Update tunnel with opened port
this.rpcTunnel[sid] = localPort;
break;
} else {
await this.nodeConnection.openTunnels([
{
dstHost: addr,
dstPort: port,
localPort: localPort,
},
]);
// Update tunnel with opened port
this.rpcTunnel[sid] = localPort;
}
} catch (e) {
// On any error stop opening further tunnels and close all already opened
await this.closeRpcTunnel();
Expand All @@ -2008,9 +2023,6 @@ export class Monitoring {
data: freshrpcstatus,
};
}

// Update tunnel with opened port
this.rpcTunnel[sid] = localPort;
}

// Respond success with fresh RPC status data
Expand Down

0 comments on commit a3d2b0c

Please sign in to comment.