Browse Source

Fix issues with exception handling after disconnect

release/3.x.x
Christian Kratky 7 years ago
parent
commit
50800b1d44
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      MQTTnet.Core/Client/MqttClient.cs

+ 10
- 0
MQTTnet.Core/Client/MqttClient.cs View File

@@ -352,6 +352,11 @@ namespace MQTTnet.Core.Client
}
catch (MqttCommunicationException exception)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}

MqttTrace.Warning(nameof(MqttClient), exception, "MQTT communication exception while sending/receiving keep alive packets.");
await DisconnectInternalAsync().ConfigureAwait(false);
}
@@ -388,6 +393,11 @@ namespace MQTTnet.Core.Client
}
catch (MqttCommunicationException exception)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}

MqttTrace.Warning(nameof(MqttClient), exception, "MQTT communication exception while receiving packets.");
await DisconnectInternalAsync().ConfigureAwait(false);
}


Loading…
Cancel
Save