From cb89fcfb75b794b1f6438e33469df4cb9ed64f9c Mon Sep 17 00:00:00 2001 From: Oleksandr Babak Date: Fri, 28 Feb 2025 05:52:35 +0100 Subject: [PATCH] fix(rumqttd): set default network timeout as `Duration::MAX` instead of zero. (#949) --- rumqttd/CHANGELOG.md | 1 + rumqttd/src/link/network.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rumqttd/CHANGELOG.md b/rumqttd/CHANGELOG.md index ed1a3248c..0837db9ae 100644 --- a/rumqttd/CHANGELOG.md +++ b/rumqttd/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - MQTT keep alive interval +- Change default network keep alive interval from `Duration::ZERO` to `Duration::MAX`. - record client id for remote link's span - session present flag in connack - Make write method return the number of bytes written correctly everywhere diff --git a/rumqttd/src/link/network.rs b/rumqttd/src/link/network.rs index f37dd76a5..eae352b90 100644 --- a/rumqttd/src/link/network.rs +++ b/rumqttd/src/link/network.rs @@ -55,7 +55,10 @@ impl Network

{ write: BytesMut::with_capacity(10 * 1024), max_incoming_size, max_connection_buffer_len, - keepalive: Duration::ZERO, + // Overwritten by keepalive value in connect packet, otherwise we + // would wait indefinitely until we get a packet / network error + // when we call read. + keepalive: Duration::MAX, protocol, } }