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

Sort the list of IDs before comparing it. #40

Merged
merged 1 commit into from
Apr 9, 2024
Merged

Sort the list of IDs before comparing it. #40

merged 1 commit into from
Apr 9, 2024

Conversation

plietar
Copy link
Contributor

@plietar plietar commented Apr 9, 2024

The list of packet IDs returned by unpacked() is always sorted lexicographically. Some tests were assuming that this was the same as packet creation order, and were comparing the list of packets against another value for equality.

However, if the packets were created very closely is time, the timestamp part of their packet ID may be equal, in which case the relative order is determined by the random bytes added to the packets. In that case, lexicographical order may not match packet creation order. This is especially likely on Windows where the timer resolution is quite coarse.

The list of packet IDs returned by `unpacked()` is always sorted
lexicographically. Some tests were assuming that this was the same as
packet creation order, and were comparing the list of packets against
another value for equality.

However, if the packets were created very closely is time, the timestamp
part of their packet ID may be equal, in which case the relative order
is determined by the random bytes added to the packets. In that case,
lexicographical order may not match packet creation order. This is
especially likely on Windows where the timer resolution is quite coarse.
@richfitz richfitz merged commit 3b33da4 into main Apr 9, 2024
7 checks passed
@plietar plietar deleted the sort-ids branch April 11, 2024 19:34
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.

None yet

2 participants