Skip to content

Commit

Permalink
* Apply 'aggressive' logic to OperationCanceledException also
Browse files Browse the repository at this point in the history
* Do not turn off 'aggressive' prematurely, before the Meadow is known to re-connect.
  • Loading branch information
alexischr committed Jan 4, 2025
1 parent 105b4f5 commit ffb139b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async Task ReOpen() // local function
{
if (AggressiveReconnectEnabled)
{
Debug.WriteLine("Aggressively re-connecting");
await ReOpen();
}
goto read;
Expand Down Expand Up @@ -344,8 +345,9 @@ async Task ReOpen() // local function
{
// this happens on disconnect - could be cable pulled, could be device reset
Debug.WriteLine($"Operation Cancelled. Port open: {_port.IsOpen}");
if (!_port.IsOpen)
if (AggressiveReconnectEnabled && !_port.IsOpen)
{
Debug.WriteLine("Aggressively re-connecting");
await ReOpen();
}
}
Expand Down
6 changes: 2 additions & 4 deletions Source/v2/Meadow.HCom/Connections/SerialConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1255,14 +1255,12 @@ public override async Task<DebuggingServer> StartDebuggingSession(int port, ILog

var debuggingServer = new DebuggingServer(this, port, logger);

logger?.LogDebug("Tell the Debugging Server to Start Listening");
Debug.WriteLine("Tell the Debugging Server to Start Listening");
await debuggingServer.StartListening(cancellationToken);

logger?.LogDebug($"Start Debugging on port: {port}");
Debug.WriteLine($"Start Debugging on port: {port}");
await Device.StartDebugging(port, logger, cancellationToken);

AggressiveReconnectEnabled = false;

return debuggingServer;
}

Expand Down

0 comments on commit ffb139b

Please sign in to comment.