mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
Merge branch 'pr/301' into develop
This commit is contained in:
@@ -349,12 +349,14 @@ namespace MQTTnet.Client
|
|||||||
keepAliveSendInterval = _options.KeepAliveSendInterval.Value;
|
keepAliveSendInterval = _options.KeepAliveSendInterval.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_sendTracker.Elapsed > keepAliveSendInterval)
|
var waitTime = keepAliveSendInterval - _sendTracker.Elapsed;
|
||||||
|
if (waitTime <= TimeSpan.Zero)
|
||||||
{
|
{
|
||||||
await SendAndReceiveAsync<MqttPingRespPacket>(new MqttPingReqPacket(), cancellationToken).ConfigureAwait(false);
|
await SendAndReceiveAsync<MqttPingRespPacket>(new MqttPingReqPacket(), cancellationToken).ConfigureAwait(false);
|
||||||
|
waitTime = keepAliveSendInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(keepAliveSendInterval, cancellationToken).ConfigureAwait(false);
|
await Task.Delay(waitTime, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
|||||||
Reference in New Issue
Block a user