diff --git a/lib/handle_publish.c b/lib/handle_publish.c index 0ce6b7b045..bc35aad77d 100644 --- a/lib/handle_publish.c +++ b/lib/handle_publish.c @@ -127,8 +127,8 @@ int handle__publish(struct mosquitto *mosq) if(mosq->protocol == mosq_p_mqtt5){ if(mosq->msgs_in.inflight_quota == 0){ message__cleanup(&message); - /* FIXME - should send a DISCONNECT here */ - return MOSQ_ERR_PROTOCOL; + send__disconnect(mosq, MQTT_RC_RECEIVE_MAXIMUM_EXCEEDED, NULL ); + return MOSQ_ERR_RECEIVE_MAXIMUM_EXCEEDED; } } diff --git a/src/handle_publish.c b/src/handle_publish.c index 891175b925..648099ea8d 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -109,14 +109,8 @@ int handle__accepted_publish(struct mosquitto *context, struct mosquitto__base_m if(!cmsg_stored){ if(base_msg->data.qos > 0 && context->msgs_in.inflight_quota == 0){ log__printf(NULL, MOSQ_LOG_WARNING, "Client %s has exceeded its receive-maximum quota. This behaviour must be fixed on the client.", context->id); -#if 0 - /* Badly behaving clients like on the esp32 fall foul of this - * check, so report it for now but don't disconnect, to give chance - * for the bad behaviour to be fixed. */ - /* Client isn't allowed any more incoming messages, so fail early */ db__msg_store_free(base_msg); return MOSQ_ERR_RECEIVE_MAXIMUM_EXCEEDED; -#endif } if(base_msg->data.qos == 0 diff --git a/test/broker/CMakeLists.txt b/test/broker/CMakeLists.txt index 584d6f9e24..927fe9a02a 100644 --- a/test/broker/CMakeLists.txt +++ b/test/broker/CMakeLists.txt @@ -15,7 +15,6 @@ endif() set(EXCLUDE_LIST 01-connect-uname-password-success-no-tls 03-publish-qos1-queued-bytes - 03-publish-qos2-max-inflight-exceeded 09-extended-auth-single2 # Not a test 06-bridge-clean-session-core @@ -81,6 +80,7 @@ add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos1-max-inflight-expire.p add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos1-max-inflight.py") add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos1-no-subscribers-v5.py") add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos1-retain-disabled.py") +add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos2-max-inflight-exceeded.py") add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos2-max-inflight.py") add_python_test(PY_TEST_NAMES ${PREFIX} 1 "03-publish-qos2-reuse-mid.py") add_python_test(PY_TEST_NAMES ${PREFIX} 2 "04-retain-check-source-persist-diff-port.py") diff --git a/test/broker/Makefile b/test/broker/Makefile index ee1c905f6c..0d5098e523 100644 --- a/test/broker/Makefile +++ b/test/broker/Makefile @@ -81,7 +81,7 @@ msg_sequence_test: ./03-publish-qos1-max-inflight-expire.py ./03-publish-qos1-no-subscribers-v5.py ./03-publish-qos1-retain-disabled.py - #./03-publish-qos2-max-inflight-exceeded.py + ./03-publish-qos2-max-inflight-exceeded.py ./03-publish-qos2-max-inflight.py ./03-publish-qos2-reuse-mid.py diff --git a/test/broker/test.py b/test/broker/test.py index e3906228c0..90cd5d0535 100755 --- a/test/broker/test.py +++ b/test/broker/test.py @@ -62,7 +62,7 @@ (1, './03-publish-qos1-max-inflight.py'), (1, './03-publish-qos1-no-subscribers-v5.py'), (1, './03-publish-qos1-retain-disabled.py'), - #(1, './03-publish-qos2-max-inflight-exceeded.py'), + (1, './03-publish-qos2-max-inflight-exceeded.py'), (1, './03-publish-qos2-max-inflight.py'), (1, './03-publish-qos2-reuse-mid.py'),