-
Notifications
You must be signed in to change notification settings - Fork 349
Reorder channel selection order and make Stop() idempotent #159
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
Conversation
I think I prefer to stick to the defer Stop() method. Having to maintain stops on all function exits is fragile. |
How about a single function which makes all the necessary |
It's not the number of function calls, it's the fact that you need to make sure they're all there at any exit from the function. This is why defer is used. |
Updated to use the defer-style syntax which I think looks better. It's objectively less code to worry about/forget in that select clause. I've also included the idempotent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment as to why the first p.sendICMP(conn) is necessary.
This also fixes #157. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just to double-verify this bullet point in the original description does not apply anymore correct?
- Removes the initial packet sent around line 403 which I can't really see a need for.
IIUC the initial packet send was re-added by 91995fe
Yep correct on all accounts @sparrc! |
abe6f7c
to
afbbb46
Compare
In my opinion, there is no guarantee order in |
This PR:
Run()
function so that we always deal with received packets first rather than sending new packet out. This is so that the TTL values don't go stale when pinging very rapidly (cf. Allow intervals of 0 seconds #154).Stop()
on tickers where possible.