* Update last activity time and reset idle timer. * Called on each acquireConnection() to keep active connections alive.
(entry: SSH2ConnectionEntry, key: string)
| 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. |
no test coverage detected