Fix TimeoutAfter again

This commit is contained in:
Christian Kratky
2017-09-20 08:32:36 +02:00
parent 222a154290
commit f287bd4d1d
+3 -3
View File
@@ -12,7 +12,7 @@ namespace MQTTnet.Core.Internal
var timeoutTask = Task.Delay(timeout); var timeoutTask = Task.Delay(timeout);
var finishedTask = await Task.WhenAny(timeoutTask, task).ConfigureAwait(false); var finishedTask = await Task.WhenAny(timeoutTask, task).ConfigureAwait(false);
if (finishedTask == timeoutTask || task.IsCanceled) if (finishedTask == timeoutTask)
{ {
throw new MqttCommunicationTimedOutException(); throw new MqttCommunicationTimedOutException();
} }
@@ -24,7 +24,7 @@ namespace MQTTnet.Core.Internal
if (task.IsFaulted) if (task.IsFaulted)
{ {
throw new MqttCommunicationException(task.Exception); throw new MqttCommunicationException(task.Exception.GetBaseException());
} }
////return TimeoutAfter(task.ContinueWith(t => 0), timeout); ////return TimeoutAfter(task.ContinueWith(t => 0), timeout);
@@ -47,7 +47,7 @@ namespace MQTTnet.Core.Internal
if (task.IsFaulted) if (task.IsFaulted)
{ {
throw new MqttCommunicationException(task.Exception); throw new MqttCommunicationException(task.Exception.GetBaseException());
} }
return task.Result; return task.Result;