moquette icon indicating copy to clipboard operation
moquette copied to clipboard

Handling of duplicate subscriptions

Open hylkevds opened this issue 3 years ago • 0 comments

The spec states:

If a Server receives a SUBSCRIBE Packet containing a Topic Filter that is identical to an existing Subscription’s Topic Filter then it MUST completely replace that existing Subscription with a new Subscription. The Topic Filter in the new Subscription will be identical to that in the previous Subscription, although its maximum QoS value could be different.

Currently, moquette only replaces the subscription if the QoS of the new subscription is higher than the old subscription. I think this is incorrect, and the subscription should be replaced if the QoS is different not just higher. Relevant code: https://github.com/moquette-io/moquette/blob/9002254325acf56d7ab698ccf80c0ed0c7eedf62/broker/src/main/java/io/moquette/broker/subscriptions/CNode.java#L97

What do you think?

hylkevds avatar Jul 21 '21 13:07 hylkevds