-
Notifications
You must be signed in to change notification settings - Fork 416
Description
If topic.unsubscribe() is called without a parameter, it will not remove the callbacks, but instead unregister the whole topic at the rosconnection. This is fine as long as the topic object is destroyed after unsubscribing, but in my use case we subscribe to the same topic instance again. This adds a new callback and re-registers at the ros connection, which means now two callbacks are executed...
The problem seems to be acknowledged in this code comment:
Line 125 in 47336fa
| // Note: Don't call this.removeAllListeners, allow client to handle that themselves |
I do not see why the client would want to handle this itself, as it seems to be the expected outcome. unsubscribe(X) removes callback X from the topic's listener-list so the paradigm seems to be "unsubscribe X from the topic`. This should be the same without parameters, but currently it is "unsubscribe the topic from ros", which changes the direction of the method.
I propose not only unsubscribing to ros, but also removing all listener callbacks.