Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Example uses total_count instead of current_count [14194]

Open akraus53 opened this issue 2 years ago • 4 comments

Is there an already existing issue for this?

  • [X] I have searched the existing issues

Expected behavior

Please look at this comment: https://github.com/eProsima/Fast-DDS/commit/3ead007f4954bc53421044e58706d7a67c4a8dff#r69181483

With this change, the matched_-variable no longer displays the current count of connected subscribers but the total amount of subscribers since the start of the program. This number can't get lower again, which it should

Current behavior

The number of connected subscribers saved in SubListener_.matched_ can't get lower again, which it should.

Steps to reproduce

Use the HelloWorldExample or any of many other similar Examples

Fast DDS version/commit

https://github.com/eProsima/Fast-DDS/commit/3ead007f4954bc53421044e58706d7a67c4a8dff#r69181483

Platform/Architecture

Ubuntu Focal 20.04 amd64

Transport layer

Default configuration, UDPv4 & SHM, UDPv4, UDPv6, TCPv4, TCPv6, Shared Memory Transport (SHM), Intra-process, Data-sharing delivery, Zero copy

Additional context

No response

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

akraus53 avatar Mar 21 '22 15:03 akraus53

Hi @akraus53,

You are correct. This is an historical issue. In the old Fast RTPS API, the current_count implementation is not correct and it holds the same value as the current_count_change. Thus the reason why total_count was used instead in the old API. This issue has been fixed in the Fast DDS API and as you say, this should be current_count instead of total_count. When the examples were migrated to the new API, the previously used counter was kept instead of fixing the examples using the correct one. Would you mind doing a PR with the changes?

JLBuenoLopez avatar Mar 21 '22 15:03 JLBuenoLopez

I'd love to, but I'm currently a bit busy with exams. I will try to keep it in mind when things get more relaxed. Do you think a "find all" for total_count in the Examples/DDS folder is enough?

akraus53 avatar Mar 21 '22 15:03 akraus53

Thanks @akraus53!

It would probably work doing the "find all". Nevertheless, the PR will have a reviewer that will look that the changes are correct. You can have a look into CONTRIBUTING policy.

JLBuenoLopez avatar Mar 22 '22 06:03 JLBuenoLopez

Okay good! As I said, I'll look into it as soon as I have some free time. Until then, I don't think this is a big problem as it's only occured after 3 years. Even if some occurences are missed, the examples will still work and issues might only occur if people are expanding on the examples and using this functionality more.

akraus53 avatar Mar 22 '22 12:03 akraus53

According to our CONTRIBUTING.md guidelines, I am closing this issue due to inactivity. Please, feel free to reopen it if necessary.

Mario-DL avatar Mar 24 '23 08:03 Mario-DL