mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 02:53:06 +08:00
Refactor web socket usage
This commit is contained in:
@@ -56,7 +56,7 @@ namespace MQTTnet.Core.Server
|
||||
{
|
||||
if (_pendingPublishPackets.Count == 0)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(5)).ConfigureAwait(false);
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(5), cancellationToken).ConfigureAwait(false);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace MQTTnet.Core.Server
|
||||
foreach (var publishPacket in packets)
|
||||
{
|
||||
publishPacket.Dup = true;
|
||||
_pendingPublishPackets.Add(publishPacket);
|
||||
_pendingPublishPackets.Add(publishPacket, cancellationToken);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
@@ -80,7 +80,7 @@ namespace MQTTnet.Core.Server
|
||||
foreach (var publishPacket in packets)
|
||||
{
|
||||
publishPacket.Dup = true;
|
||||
_pendingPublishPackets.Add(publishPacket);
|
||||
_pendingPublishPackets.Add(publishPacket, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace MQTTnet.Core.Server
|
||||
}
|
||||
finally
|
||||
{
|
||||
await eventArgs.ClientAdapter.DisconnectAsync().ConfigureAwait(false);
|
||||
await eventArgs.ClientAdapter.DisconnectAsync(_options.DefaultCommunicationTimeout).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user