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

Identify reply by host, indentifier and sequence number #22

Merged
merged 3 commits into from
May 24, 2022

Conversation

oll3
Copy link
Contributor

@oll3 oll3 commented May 21, 2022

Hi @kolapapa,

I wanted to modify the library to allow it to send a payload smaller than 16 bytes. To achieve this I replaced the lookup of replies using the uuid/random identifier carried in payload by using the pinged host+ping identifier+sequence number. So for each sent request we expect a reply with the same parameters. This change also means that two pingers pinging the same host with the same ident and same sequence number at the same time can not be allowed. Trying to do this now will result in an error.

However my initial, seemingly small change ended up being quite big. And I realize this might not suite this library and your case so I very much understand if you won't accept this PR. Still wanted to give you a chance to have a look and see if it can be to any use.

Thanks again for sharing this library!

oll3 added 3 commits May 21, 2022 13:18
For extra type safety when shuffling around these u16 values.
Instead of passing a randomized unique value as payload to identify a specific reply use the host, identity and sequence number.
This allows us to send a payload of 0-N bytes instead of 16-N.

Also changed Pinger::ping() to take a u8 slice for payload.
@kolapapa
Copy link
Owner

@oll3 Thanks a lot for your PR~
I think these changes are reasonable and good, I have no opinion 🎉

@kolapapa kolapapa merged commit d88a94c into kolapapa:main May 24, 2022
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