#4869 closed defect (fixed)
[cometd][patch][ccla] Clean up subscribe/unsubscribe logic
Reported by: | brendonh | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | Dojox | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
When cometd.subscribe is called, it hooks up the subscription via dojo.subscribe, putting the resulting handle in this.topics[tname]. Later, when cometd.unsubscribe is called, dojo.unsubscribe is called on that handle.
However, if you subscribe to the same channel twice without unsubscribing, the first handle is lost. The subscription remains, and now you get two dojo messages for every cometd message on that channel.
Meanwhile, cometd.unsubscribe takes objOrFunc and funcName arguments, and then does nothing with them. But if you don't provide objOrFunc, dojo.unsubscribe is never called (even though a Bayeux unsubscribe message is sent). This creates the same mess as above.
This patch:
- Removes the existing dojo subscription (if it exists) before creating a new one
- Removes objOrFunc and funcName from cometd.unsubscribe's parameter list (they did nothing)
- Always removes dojo subscriptions in cometd.unsubscribe (if one exists)
- Fixes some wrong comments where people (including me!) had copied and pasted code from cometd.subscribe to cometd.unsubscribe
- Removes some miscellaneous extra whitespace in various places, because my emacs setup is too clever for its own good.
Cheers,
Brendon
Attachments (1)
Change History (2)
Changed 13 years ago by
comment:1 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [11119]) merging patch for subscribe/unsubscribe cleanup from Brendon. Fixes #4869