Hardening Production Use
Production use revealed several edge cases that needed addressing. The SSH connection, in particular, required robustification to handle the realities of WSL lifecycle management.
SSH Keep-Alive Improvements
The initial SSH implementation used basic connection parameters. Through real-world testing, three critical options were added:
ServerAliveInterval=15: Sends a keep-alive message every 15 secondsServerAliveCountMax=3: Allows 3 missed keep-alives before disconnectingTCPKeepAlive=no: Disables TCP-level keep-alive to avoid conflicts with SSH-level keep-alive
These options dramatically improved connection stability, especially during periods of low activity.
Retry Logic for WSL Startup
A common scenario emerged: the user enables SSH before WSL is fully ready. Instead of failing silently, WslDock now implements a retry mechanism:
- If SSH fails to connect, start a 2-second timer
- When the timer fires, attempt to reconnect
- Repeat until successful or the user deactivates SSH
This is implemented using SetTimer with a non-blocking approach, ensuring the tray icon remains responsive during
retry attempts.
Non-Blocking Timer Fix
The initial retry implementation used Sleep(2000), which blocked the main thread and made the tray icon unresponsive.
This was replaced with SetTimer and WM_TIMER dispatch, maintaining a fully responsive UI even during connection
attempts.
The progression from basic functionality to production-hardened implementation is a common pattern in system utilities. Each edge case—from SSH timing to retry logic—represents a real-world scenario that wasn’t apparent in initial testing. The non-blocking timer fix, in particular, demonstrates the importance of maintaining UI responsiveness even in background tools.





