ros_comm
ros_comm copied to clipboard
Fix #2249: Topic statistics do not handle well ROS time jumping back
First, I'm submitting a failing test.
It makes 4 repetitions of receiving 10000 messages, each time resetting ROS time from 1.0 onwards. First repetition is okay. If #2249 is not fixed, the following iterations will take considerably longer because the internal lists are never cleared.
And the fix comes.
Is there actually reason to copy the whole stats structure twice in each callback? Wouldn't it be better to modify it directly via an auto&
? Could the reason be keeping the lists consistent even in usage by different threads? But that would mean some data would be lost if more threads were overwriting the stats structure...
@mjcarroll @sloretz friendly ping