Additional performance improvements

This commit is contained in:
Christian Kratky
2017-09-09 23:53:42 +02:00
parent 4a6790f0aa
commit 76151deba0
18 changed files with 100 additions and 103 deletions
@@ -38,6 +38,7 @@ namespace MQTTnet.Implementations
public async Task ConnectAsync(MqttClientOptions options)
{
if (options == null) throw new ArgumentNullException(nameof(options));
try
{
if (_socket == null)
@@ -97,12 +98,11 @@ namespace MQTTnet.Implementations
try
{
int totalBytes = 0;
var totalBytes = 0;
do
{
var read = await _dataStream.ReadAsync(buffer, totalBytes, buffer.Length - totalBytes).ConfigureAwait(false);
if (read == 0)
{
throw new MqttCommunicationException(new SocketException((int)SocketError.Disconnecting));