MCPcopy
hub / github.com/coder/mux / touchConnection

Method touchConnection

src/node/runtime/SSH2ConnectionPool.ts:391–403  ·  view source on GitHub ↗

* Update last activity time and reset idle timer. * Called on each acquireConnection() to keep active connections alive.

(entry: SSH2ConnectionEntry, key: string)

Source from the content-addressed store, hash-verified

389 * Called on each acquireConnection() to keep active connections alive.
390 */
391 private touchConnection(entry: SSH2ConnectionEntry, key: string): void {
392 entry.lastActivityAt = Date.now();
393
394 // Clear existing idle timer
395 if (entry.idleTimer) {
396 clearTimeout(entry.idleTimer);
397 }
398
399 // Set new idle timer
400 entry.idleTimer = setTimeout(() => {
401 this.closeIdleConnection(key, entry);
402 }, IDLE_TIMEOUT_MS);
403 }
404
405 /**
406 * Close a connection that has been idle for too long.

Callers 1

acquireConnectionMethod · 0.95

Calls 1

closeIdleConnectionMethod · 0.95

Tested by

no test coverage detected