fix: copilot suggestions from PR review

This commit is contained in:
Andrew Welker
2025-11-03 11:02:39 -06:00
parent 0d083e63c6
commit 9426dff5df
4 changed files with 6 additions and 9 deletions

View File

@@ -278,7 +278,7 @@ namespace PepperDash.Core
if (shellStream.DataAvailable)
{
// empty the buffer if there is data
string str = shellStream.Read();
shellStream.Read();
}
shellStream.DataReceived += Stream_DataReceived;
this.LogInformation("Connected");
@@ -288,7 +288,6 @@ namespace PepperDash.Core
catch (SshConnectionException e)
{
var ie = e.InnerException; // The details are inside!!
var errorLogLevel = disconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
if (ie is SocketException)
{
@@ -335,7 +334,6 @@ namespace PepperDash.Core
}
catch (Exception e)
{
var errorLogLevel = disconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
this.LogError("Unhandled exception on connect: {error}", e.Message);
this.LogVerbose(e, "Exception details: ");
disconnectLogged = true;
@@ -518,7 +516,7 @@ namespace PepperDash.Core
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
StopReconnectTimer();
StartReconnectTimer();
}
catch (Exception ex)
{
@@ -551,7 +549,7 @@ namespace PepperDash.Core
this.LogException(ex, "ObjectDisposedException sending {message}", ComTextHelper.GetEscapedText(bytes));
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
StopReconnectTimer();
StartReconnectTimer();
}
catch (Exception ex)
{

View File

@@ -477,8 +477,7 @@ namespace PepperDash.Core
/// </summary>
public void SendBytes(byte[] bytes)
{
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
this.PrintSentBytes(bytes);
if (_client != null)
_client.SendData(bytes, bytes.Length);
}

View File

@@ -19,6 +19,6 @@ namespace PepperDash.Core
/// <summary>
/// Debug data in both byte and text formats
/// </summary>
Both = Bytes | Text,
Both = Bytes | Text
}
}