udp-discovery-cpp icon indicating copy to clipboard operation
udp-discovery-cpp copied to clipboard

PacketIndex is increased even when userdata didn't change

Open zapek opened this issue 4 years ago • 1 comments

When a packet is received, packet_index is checked for increments to see if the userdata needs to be updated: https://github.com/truvorskameikin/udp-discovery-cpp/blob/63eda22d3f8a415324d99208011bc4f2b6583a7e/udp_discovery_peer.cpp#L351

But here: https://github.com/truvorskameikin/udp-discovery-cpp/blob/63eda22d3f8a415324d99208011bc4f2b6583a7e/udp_discovery_peer.cpp#L397

packet_index is incremented everytime a packet is sent, even if the userdata didn't change.

Shouldn't it be increased only if the userdata changed?

zapek avatar Feb 07 '21 16:02 zapek

That is a good idea to not increment packet_index every send. And I think that it also can be renamed to something like snapshot_index. Now it should increase on every user_data change.

truvorskameikin avatar Jun 22 '21 15:06 truvorskameikin