|
@@ -183,10 +183,12 @@ namespace MQTTnet.Client |
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
public void Dispose() |
|
|
{ |
|
|
{ |
|
|
|
|
|
_cancellationTokenSource?.Cancel (false); |
|
|
_cancellationTokenSource?.Dispose(); |
|
|
_cancellationTokenSource?.Dispose(); |
|
|
_cancellationTokenSource = null; |
|
|
_cancellationTokenSource = null; |
|
|
|
|
|
|
|
|
_adapter?.Dispose(); |
|
|
_adapter?.Dispose(); |
|
|
|
|
|
_adapter = null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task<MqttConnAckPacket> AuthenticateAsync(MqttApplicationMessage willApplicationMessage, CancellationToken cancellationToken) |
|
|
private async Task<MqttConnAckPacket> AuthenticateAsync(MqttApplicationMessage willApplicationMessage, CancellationToken cancellationToken) |
|
@@ -245,10 +247,7 @@ namespace MQTTnet.Client |
|
|
} |
|
|
} |
|
|
finally |
|
|
finally |
|
|
{ |
|
|
{ |
|
|
_adapter?.Dispose(); |
|
|
|
|
|
_adapter = null; |
|
|
|
|
|
_cancellationTokenSource?.Dispose(); |
|
|
|
|
|
_cancellationTokenSource = null; |
|
|
|
|
|
|
|
|
Dispose (); |
|
|
_cleanDisconnectInitiated = false; |
|
|
_cleanDisconnectInitiated = false; |
|
|
|
|
|
|
|
|
_logger.Info("Disconnected."); |
|
|
_logger.Info("Disconnected."); |
|
@@ -394,6 +393,7 @@ namespace MQTTnet.Client |
|
|
|
|
|
|
|
|
if (exception is OperationCanceledException) |
|
|
if (exception is OperationCanceledException) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_logger.Verbose ("MQTT OperationCanceled exception while receiving packets."); |
|
|
} |
|
|
} |
|
|
else if (exception is MqttCommunicationException) |
|
|
else if (exception is MqttCommunicationException) |
|
|
{ |
|
|
{ |
|
|