Replace the individual descriptions with a reference to section 4.13.
So, for example 3.3.1.2 QoS changes from ...
A PUBLISH Packet MUST NOT have both QoS bits set to 1.
If a Server or Client receives a PUBLISH packet which has both QoS
bits set to 1 it is a Malformed Packet. The receiver SHOULD send
a DISCONNECT packet with Return Code of 0x81 (Malformed Packet)
and MUST close the Network Connection.
to ...
A PUBLISH Packet MUST NOT have both QoS bits set to 1.
If a Server or Client receives a PUBLISH packet which has both QoS
bits set to 1 it is a Malformed Packet. Use DISCONNECT Return Code 0x81
(Malformed Packet) as described in section 4.13 Handling errors.
Section 4.13 becomes.
4.13 Handling errors
4.13.1 Malformed Packet and Protocol Errors
Definitions of Malformed Packet and Protocol Errors are contained in
section 1.2 Terminology, some but not all, of these error cases are noted
throughout the specification. The rigour with which a Client or Server
checks an MQTT Control Packet it has received will be a compromise between:
- The size of the Client or Server implementation.
- The capabilities that the implementation supports.
- The degree to which the receiver trusts the sender to send correct
MQTT Control Packets.
- The degree to which the receiver trusts the network to deliver
MQTT Control Packets correctly.
- The consequences of continuing to process a packet that is incorrect.
If the sender is compliant with this specification it will not send
Malformed Packets or cause Protocol Errors. However, if a Client sends
MQTT Control Packets before it receives CONNACK,
it might cause a Protocol Error because it made an incorrect
assumption about the Server capabilities. See section 3.1.4 Response.
The return codes used for Malformed Packet and Protocol Errors are:
129 0x81 Malformed Packet CONNACK, DISCONNECT
130 0x82 Protocol Error CONNACK, DISCONNECT
147 0x93 Receive Maximum exceeded DISCONNECT
149 0x95 Packet too large CONNACK, DISCONNECT
154 0x9A Retain not supported DISCONNECT
155 0x9B QoS not supported DISCONNECT
158 0x9E Shared Subscription not supported SUBACK, DISCONNECT
161 0xA1 Subscription Identifiers not supported SUBACK, DISCONNECT
162 0xA2 Wildcard Subscription not supported SUBACK, DISCONNECT
Where Client receives a Malformed Packet or detects a Protocol Error,
and a return code is mentioned in the specification,
it SHOULD close the Network Connection.
In the case of an error in a AUTH packet
it MAY send an AUTH packet containing that return code,
before closing the Network Connection.
If the case of an error in any other packet
it SHOULD send a DISCONNECT packet containing the return code
before closing the Network Connection.
Where Server receives a Malformed Packet or detects a Protocol Error,
and a return code is mentioned in the specification,
it MUST close the Network Connection.
In the case of an error in a CONNECT packet
it MAY send a CONNACK packet or AUTH packet containing the return code,
before closing the Network Connection.
In the case of an error in any other packet
it SHOULD send a DISCONNECT packet containing the return code
before closing the Network Connection.
If either the Server or Client omits to check some feature of an
MQTT Control Packet, it might fail to detect an error, consequently it
might allow data to be damaged.
If the Client or Server encounters a Malformed Packet or Protocol Error
it MUST close the Network Connection.
Before closing the Network Connection, it SHOULD send a DISCONNECT packet
containing return code
0x81 (Malformed Packet) or 0x82 (Protocol Error).
There are no consequences for other Sessions.
4.13.2 Other errors
Errors other than Malformed Packet and Protocol Errors cannot be anticipated
by the sender because the receiver may have constraints which it has not
communicated to the sender. A receiving Client or Server might encounter a
transient error, such as a shortage of memory, that prevents successful processing
of an individual MQTT Control Packet.
Acknowledgment packets PUBACK, PUBREC, PUBREL, PUBCOMP, SUBACK, UNSUBACK
allow a Return Code of 128 or greater to indicate that the received packet,
identified by a Packet Identifier, was in error.
There are no consequences for other Sessions or other Packets flowing
on the same session.
The CONNACK and DISCONNECT packets allow a Return Code of 128 or greater to indicate
that the Network Connection will be closed. Some of these return codes are sent for reasons
other than in response to an inbound packet. Sending of one of these return codes
does not have consequence for any other Session.