Fix exception handling when using invalid host names upon connect.

This commit is contained in:
Christian Kratky
2020-04-24 19:29:03 +02:00
parent 5df4fc3d5d
commit e798c91ff3
4 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -333,7 +333,7 @@ namespace MQTTnet.Client
await Task.WhenAll(receiverTask, publishPacketReceiverTask, keepAliveTask).ConfigureAwait(false);
_publishPacketReceiverQueue.Dispose();
_publishPacketReceiverQueue?.Dispose();
}
catch (Exception e)
{
@@ -71,6 +71,8 @@ namespace MQTTnet.Implementations
await socket.ConnectAsync(_options.Server, _options.GetPort(), cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
var networkStream = socket.GetStream();
if (_options.TlsOptions?.UseTls == true)