* Cancel the TokenSource when disposing or nulling it out for the MqttClient

This commit is contained in:
Andre Crabb
2018-09-20 11:08:33 -04:00
parent 23ae8ab3b5
commit 39bc70cbf0
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -125,7 +125,7 @@ namespace MQTTnet.Server
}
_adapter = null;
_cancellationTokenSource?.Cancel ();
_cancellationTokenSource?.Dispose();
_cancellationTokenSource = null;
}
@@ -240,7 +240,9 @@ namespace MQTTnet.Server
{
_pendingPacketsQueue?.Dispose();
_cancellationTokenSource?.Cancel ();
_cancellationTokenSource?.Dispose();
_cancellationTokenSource = null;
}
private void ProcessReceivedPacket(IMqttChannelAdapter adapter, MqttBasePacket packet, CancellationToken cancellationToken)