eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
888 stars 363 forks source link

Question about publisher dds_suspend() #2116

Open AngelVI13 opened 4 weeks ago

AngelVI13 commented 4 weeks ago

Hello, I just want to ask for information on dds_suspend() and dds_resume() functionality for publishers. Is there any plans for the implementation of these features? I looked at the roadmap but was confused if these are covered by some of the bullet points there. Thank you very much in advance and have a lovely day :)

eboasson commented 3 weeks ago

Hi @AngelVI13 I had completely forgotten about them 😱 Clearly that means I currently have no plans for it, but it can be done fairly easily. Currently it does support batching via a QoS where you explicitly have to flush the batch when you want to be sure it gets sent. That you can set via dds_qset_writer_batching, which ultimately makes it way to whc_batch, which then controls whether data gets sent immediately or not, at:

https://github.com/eclipse-cyclonedds/cyclonedds/blob/b4753700e09789346b83e5b0305a09fbec4dfc10/src/core/ddsc/src/dds_write.c#L443-L444

So changing that whc_batch to an int and letting dds_suspend increment it, dds_resume decrement it and calling ddsi_xpack_send send in dds_resume if whc_batch becomes 0 should do it.

If you feel adventurous, do try! I'd be happy to merge a PR that implements it.