MCPcopy Index your code
hub / github.com/coder/mux / closeIdleConnection

Method closeIdleConnection

src/node/runtime/SSH2ConnectionPool.ts:408–429  ·  view source on GitHub ↗

* Close a connection that has been idle for too long.

(key: string, entry: SSH2ConnectionEntry)

Source from the content-addressed store, hash-verified

406 * Close a connection that has been idle for too long.
407 */
408 private closeIdleConnection(key: string, entry: SSH2ConnectionEntry): void {
409 // Verify this is still the active connection for this key
410 if (this.connections.get(key) !== entry) {
411 return;
412 }
413
414 this.connections.delete(key);
415
416 try {
417 entry.client.end();
418 } catch {
419 // Ignore errors closing the connection
420 }
421
422 if (entry.proxyProcess?.exitCode === null) {
423 try {
424 entry.proxyProcess.kill();
425 } catch {
426 // Ignore errors killing proxy
427 }
428 }
429 }
430
431 private async connect(
432 config: SSHConnectionConfig,

Callers 2

touchConnectionMethod · 0.95
connectWithKeyMethod · 0.95

Calls 4

getMethod · 0.65
killMethod · 0.65
deleteMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected