Rather than describing mechanisms (if this bit is set in this control packet), could we simplify these cases throughout the document? For example:
1632 If the Server included Retain Available in its CONNACK response to a Client with it’s value set to 0 and it
1633 receives a PUBLISH Packet with the RETAIN flag is set to 1
might be easier to read as:
If the server does not support message retention (see Retain Available section) and receives a PUBLISH Packet with the Retain Flag set to 1,
2.the last retained message [is] sent to the Client with its RETAIN flag set to 1.
1636 When a new non-shared subscription is established, the last retained message, if any, on each matching
1637 topic name are sent to the Client. These messages are sent with the RETAIN flag set to 1.
3. The Retain Handling Subscription Option controls which retained messages are sent.
1637 ... Which
1638 retained messages are sent is controlled by the Retain Handling Subscription Option.
4. , [the] Server MUST NOT
1644 • If Retain Handling is set to 2, The Server MUST NOT send retained messages at the time of the
5. If the server receives a PUBLISH Packet with the RETAIN=1 and QoS=0, it SHOULD store the message as the new retained message for that topic. It MAY also choose to discard it ...
1647 If the Server receives a PUBLISH Packet with the RETAIN flag set to 1, and QoS 0 it SHOULD store the
1648 new QoS 0 message as the new retained message for that topic, but MAY choose to discard it at any
6. Besides the inconsistencies in referring to Retain as Published, aren't these statements basically saying the same thing? Perhaps I'm missing something.
1662 • If the subscription has Retain As Published set to 1, the Server MUST set the RETAIN flag equal
1663 to the RETAIN flag in the received PUBLISH Packet.
1665 If the Retain As Published subscription option is 1, when sending a PUBLISH Packet to a Client the
1666 Server MUST set the RETAIN flag equal to the RETAIN flag of the message it received.