Refactor latest changes

This commit is contained in:
Christian Kratky
2017-09-15 15:26:26 +02:00
parent eed56cdf55
commit 76105de4c7
18 changed files with 280 additions and 274 deletions
+13 -11
View File
@@ -25,20 +25,22 @@ namespace MQTTnet.Core.Internal
try
{
cancellationTokenSource.CancelAfter(timeout);
#pragma warning disable 4014
task.ContinueWith(t =>
{
if (t.IsFaulted)
{
tcs.TrySetException(t.Exception);
}
#pragma warning restore 4014
{
if (t.IsFaulted)
{
tcs.TrySetException(t.Exception);
}
if (t.IsCompleted)
{
tcs.TrySetResult(t.Result);
}
}, cancellationTokenSource.Token);
if (t.IsCompleted)
{
tcs.TrySetResult(t.Result);
}
}, cancellationTokenSource.Token);
cancellationTokenSource.CancelAfter(timeout);
return await tcs.Task;
}
catch (TaskCanceledException)