fix(core-ssh): harden GenericSshClient shutdown reconnect guards

This commit is contained in:
Robert Sanders 2026-08-20 16:39:20 -04:00
parent a55e4811b3
commit 4ca59e3186

View file

@ -228,15 +228,14 @@ namespace PepperDash.Core
return; return;
} }
ConnectEnabled = true;
if (_isProgramStopping) if (_isProgramStopping)
{ {
this.LogDebug("Skipping connect because program is stopping"); this.LogDebug("Skipping connect because program is stopping");
ConnectEnabled = false;
return; return;
} }
ConnectEnabled = true;
try try
{ {
connectLock.Wait(); connectLock.Wait();
@ -517,7 +516,7 @@ namespace PepperDash.Core
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim()); this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED); KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
if (ConnectEnabled && !_isProgramStopping) if (AutoReconnect && ConnectEnabled && !_isProgramStopping)
{ {
StartReconnectTimer(); StartReconnectTimer();
} }
@ -553,7 +552,7 @@ namespace PepperDash.Core
this.LogException(ex, "ObjectDisposedException sending {message}", ComTextHelper.GetEscapedText(bytes)); this.LogException(ex, "ObjectDisposedException sending {message}", ComTextHelper.GetEscapedText(bytes));
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED); KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
if (ConnectEnabled && !_isProgramStopping) if (AutoReconnect && ConnectEnabled && !_isProgramStopping)
{ {
StartReconnectTimer(); StartReconnectTimer();
} }