Remove batch sending of messages to prevent message reordering and several required awaits.

This commit is contained in:
Christian Kratky
2018-06-15 00:19:51 +02:00
parent 26eed30dbf
commit 6192685671
14 changed files with 106 additions and 127 deletions
@@ -65,7 +65,7 @@ namespace MQTTnet.Benchmarks
for (var i = 0; i < 10000; i++)
{
_channelAdapter.SendPacketsAsync(TimeSpan.FromSeconds(15), new[] { _packet }, CancellationToken.None).GetAwaiter().GetResult();
_channelAdapter.SendPacketAsync(TimeSpan.FromSeconds(15), _packet, CancellationToken.None).GetAwaiter().GetResult();
}
_stream.Position = 0;
@@ -36,14 +36,11 @@ namespace MQTTnet.Core.Tests
return Task.FromResult(0);
}
public Task SendPacketsAsync(TimeSpan timeout, IEnumerable<MqttBasePacket> packets, CancellationToken cancellationToken)
public Task SendPacketAsync(TimeSpan timeout, MqttBasePacket packet, CancellationToken cancellationToken)
{
ThrowIfPartnerIsNull();
foreach (var packet in packets)
{
Partner.EnqueuePacketInternal(packet);
}
Partner.EnqueuePacketInternal(packet);
return Task.FromResult(0);
}