mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 10:26:11 +08:00
Fix Unit Tests.
This commit is contained in:
@@ -201,7 +201,9 @@ namespace MQTTnet.Extensions.WebSocket4Net
|
||||
_webSocket.Opened += SuccessHandler;
|
||||
_webSocket.Error += ErrorHandler;
|
||||
|
||||
#pragma warning disable AsyncFixer02 // Long-running or blocking operations inside an async method
|
||||
_webSocket.Open();
|
||||
#pragma warning restore AsyncFixer02 // Long-running or blocking operations inside an async method
|
||||
|
||||
var exception = await MqttTaskTimeout.WaitAsync(c =>
|
||||
{
|
||||
|
||||
@@ -142,12 +142,14 @@ namespace MQTTnet.Client
|
||||
|
||||
ThrowIfDisposed();
|
||||
|
||||
var disconnectIsPending = DisconnectIsPending();
|
||||
|
||||
try
|
||||
{
|
||||
_disconnectReason = MqttClientDisconnectReason.NormalDisconnection;
|
||||
_cleanDisconnectInitiated = true;
|
||||
|
||||
if (IsConnected)
|
||||
if (!disconnectIsPending && _isConnected)
|
||||
{
|
||||
var disconnectPacket = _adapter.PacketFormatterAdapter.DataConverter.CreateDisconnectPacket(options);
|
||||
await SendAsync(disconnectPacket, cancellationToken).ConfigureAwait(false);
|
||||
@@ -155,7 +157,7 @@ namespace MQTTnet.Client
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!DisconnectIsPending())
|
||||
if (!disconnectIsPending)
|
||||
{
|
||||
await DisconnectInternalAsync(null, null, null).ConfigureAwait(false);
|
||||
}
|
||||
@@ -364,11 +366,6 @@ namespace MQTTnet.Client
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_backgroundCancellationTokenSource?.IsCancellationRequested == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_backgroundCancellationTokenSource?.Cancel(false);
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
||||
Reference in New Issue
Block a user