diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2019-06-10 21:32:14 +0300 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2019-06-28 14:01:06 +0000 |
commit | 2d2a226a9e09a7faa73352febd7bd8e33c0c50a7 (patch) | |
tree | 7f6b04282c85310f4dd6913069fa1495a34d348d | |
parent | f86b2882f9933e7929eae2a9c600a384727f6090 (diff) |
Fix meaning of `Maximum Receive` connection property
as per MQTT Version 5.0 Standard, `Maximum Receive` property
is the maximum amount of unaknowledged messages (QoS>0),
whilst `Maximum QoS` property is the message's maximum allowed QoS level.
Change-Id: Ia23b259a95f075f71b7eb090f48fc9143aeb4811
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
-rw-r--r-- | src/mqtt/qmqttconnectionproperties.cpp | 28 | ||||
-rw-r--r-- | src/mqtt/qmqttconnectionproperties.h | 2 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/mqtt/qmqttconnectionproperties.cpp b/src/mqtt/qmqttconnectionproperties.cpp index aae5b58..815588d 100644 --- a/src/mqtt/qmqttconnectionproperties.cpp +++ b/src/mqtt/qmqttconnectionproperties.cpp @@ -311,17 +311,19 @@ void QMqttConnectionProperties::setSessionExpiryInterval(quint32 expiry) } /*! - Sets the maximum QoS level the client is allowed to receive to \a qos. + Sets the maximum amount of QoS 1 and QoS 2 publications + that the client is willing to process concurrently for this session + to \a maximumReceive. A maximum receive value of 0 is not allowed. */ -void QMqttConnectionProperties::setMaximumReceive(quint16 qos) +void QMqttConnectionProperties::setMaximumReceive(quint16 maximumReceive) { - if (qos == 0) { + if (maximumReceive == 0) { qCDebug(lcMqttConnection) << "Maximum Receive is not allowed to be 0."; return; } - data->maximumReceive = qos; + data->maximumReceive = maximumReceive; } /*! @@ -430,7 +432,10 @@ quint32 QMqttConnectionProperties::sessionExpiryInterval() const } /*! - Returns the maximum QoS level the client can receive. + Returns the maximum amount of QoS 1 and QoS 2 publications + that the client (when obtained from \l QMqttClient::connectionProperties()) + or the server (when obtained from \l QMqttClient::serverConnectionProperties()) + is willing to process concurrently for this session. */ quint16 QMqttConnectionProperties::maximumReceive() const { @@ -542,8 +547,17 @@ bool QMqttServerConnectionProperties::isValid() const } /*! - Returns the maximum QoS level the server is able to understand. - The default value is 2. + Returns the maximum QoS level the server supports for publishing messages. + Publishing messages with QoS level exceeding the maximum QoS level reported by the server + is a protocol violation. + + If the client does not need to support QoS 1 or QoS 2, it should restrict the maximum QoS level + in any subscription it does to a value it can support; the server would then publish messages + with the maximum of supported and restricted QoS levels. + + The default value is \c 2. + + \sa QMqttClient::publish(), QMqttClient::subscribe() */ quint8 QMqttServerConnectionProperties::maximumQoS() const { diff --git a/src/mqtt/qmqttconnectionproperties.h b/src/mqtt/qmqttconnectionproperties.h index fb41853..fd7301a 100644 --- a/src/mqtt/qmqttconnectionproperties.h +++ b/src/mqtt/qmqttconnectionproperties.h @@ -89,7 +89,7 @@ public: QByteArray authenticationData() const; void setSessionExpiryInterval(quint32 expiry); - void setMaximumReceive(quint16 qos); + void setMaximumReceive(quint16 maximumReceive); void setMaximumPacketSize(quint32 packetSize); void setMaximumTopicAlias(quint16 alias); void setRequestResponseInformation(bool response); |