Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utp packet heap #702

Merged
merged 10 commits into from
Jan 13, 2025
Merged

Utp packet heap #702

merged 10 commits into from
Jan 13, 2025

Conversation

ScottyPoi
Copy link
Collaborator

Replaces uTP Packet Queue array with Heap from heap-js.

Heap will sort packets waiting in queue so that out-of-order packets are reordered. This will cut back on unnecessary Selective Ack responses.

When receiving streams, especially from Trin nodes, we often receive pairs of packets with identical timestamps, and regularly end up processing them in the wrong order.

  • For example, we receive packets 1 and 2 simultaneously, but process packet 2 then packet 1. Next we recieve 3 and 4, but process 4 before 3.
  • This results in a lot of extra packets being exchanged due the the Selective Ack function. We report every other packet at missing, even though it isn't. So We get multiples of every other packet and send extra ACK packets.

The processCurrentPacket method was updated to skip repeat packets, and to requeue packets that arrive ahead of the current reader position. This update allows the packet-pair phenomenon to self correct.

Also updated and improved some logs, and added a method to report the total number of open uTP streams.

@ScottyPoi ScottyPoi marked this pull request as draft January 10, 2025 16:45
@ScottyPoi ScottyPoi marked this pull request as ready for review January 10, 2025 22:51
Copy link
Collaborator

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, with one change for clarity needed I think. Otherwise, go ahead and merge and don't wait for an approval from me

Copy link
Collaborator

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@acolytec3 acolytec3 merged commit 2b78274 into master Jan 13, 2025
5 checks passed
@acolytec3 acolytec3 deleted the utp-packet-heap branch January 13, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants