Refactoring

This commit is contained in:
Christian Kratky
2017-10-19 18:50:22 +02:00
parent 9915cc4492
commit 40b1be075c
31 changed files with 166 additions and 137 deletions
@@ -113,7 +113,8 @@ namespace MQTTnet.TestApp.NetCore
.Select(i => CreateMessage())
.ToList();
if (true)
Console.WriteLine("Press 'c' for concurrent sends. Otherwise in one batch.");
if (Console.ReadKey().KeyChar == 'c')
{
//send concurrent (test for raceconditions)
var sendTasks = msgs
@@ -161,10 +162,7 @@ namespace MQTTnet.TestApp.NetCore
private static Task PublishSingleMessage(IMqttClient client, MqttApplicationMessage applicationMessage, ref int count)
{
Interlocked.Increment(ref count);
return Task.Run(() =>
{
return client.PublishAsync(applicationMessage);
});
return Task.Run(() => client.PublishAsync(applicationMessage));
}
private static async Task RunServerAsync()