Skip to content

Commit

Permalink
Fix: Timer reset only on egress (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
pglombardo authored Jul 2, 2024
1 parent 5d66deb commit f51e332
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Source/HiveMQtt/Client/HiveMQClientTrafficProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Task ConnectionMonitorAsync(CancellationToken cancellationToken) => Task
{
try
{
// If connected and no recent traffic, send a ping
// If connected and no recent packets have been sent, send a ping
if (this.ConnectState == ConnectState.Connected)
{
if (this.lastCommunicationTimer.Elapsed > TimeSpan.FromSeconds(keepAlivePeriod))
Expand Down Expand Up @@ -949,7 +949,6 @@ internal async ValueTask<ReadResult> ReadAsync(CancellationToken cancellationTok
}

var readResult = await this.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
this.lastCommunicationTimer.Restart();
return readResult;
}
}
2 changes: 1 addition & 1 deletion Source/HiveMQtt/Client/Options/HiveMQClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public HiveMQClientOptions()
// When resolving a DNS hostname in the Host property, prefer IPv6 addresses over IPv4 addresses.
public bool PreferIPv6 { get; set; }

// The the maximum time interval that is permitted to elapse between the point at which the Client
// The the maximum time interval in seconds that is permitted to elapse between the point at which the Client
// finishes transmitting one MQTT Control Packet and the point it starts sending the next.
// Valid values: 0..65535
public int KeepAlive { get; set; }
Expand Down

0 comments on commit f51e332

Please sign in to comment.