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

Improve ping script output readability #45

Merged
merged 3 commits into from
Oct 27, 2024
Merged

Improve ping script output readability #45

merged 3 commits into from
Oct 27, 2024

Conversation

ThirteenFish
Copy link
Contributor

@ThirteenFish ThirteenFish commented Oct 8, 2024

Previously each ping iteration could print up to three lines, and it was sometimes easy to miss if the latest iteration succeeded or failed. This tries to limit each iteration to only a single vertically aligned line, printing information as it comes in.

While I was here I simplified the implementation:

  • By being a little more careful about where and how long blocking happens I was able to drop multiple threads. This makes coordinating printing lines and shared data much easier
  • Fixed timestamp tracking, it now correctly tracks packets delayed for more than one loop.

Copy link
Member

@ryanpdx ryanpdx left a comment

Choose a reason for hiding this comment

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

This is simpler, but it does remove some functionality, tho the need for that functionality is an edge case.

The new style seems to expect one or none ping responses between sent pings while the old style could handle receiving any response at any time.

Previously each ping iteration could print up to three lines, and it was
sometimes easy to miss if the latest iteration succeeded or failed. This
tries to limit each iteration to only a single vertically aligned line,
printing information as it comes in.

While I was here I simplified the implementation:
- By being a little more careful about where and how long blocking
  happens I was able to drop multiple threads. This makes coordinating
  printing lines and shared data much easier
- Removed previous loop timestamp tracking, it didn't seem to work
  anyway?
Adds back the capability to handle ping responses that are batched (for
example try to a local c3 with the argument -l 25), and also some amount
of handling for stranger anomalous conditions.

Display has been now separated out from the logic, class Link handles
the meaty bits and ping_loop() runs the top level loop and displays the
output. Output has been enhanced with unicode and the ability to handle
batched received packets.

Adds a --count argument to stop after attempting to send count pings
Copy link
Member

@ryanpdx ryanpdx left a comment

Choose a reason for hiding this comment

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

Looks good, I would change a couple variable names for readability, tho it shouldn't block the merge

self.echo = 0
self.seqn = seqn
self.hmac = hmac
self.stim: OrderedDict[int, float] = OrderedDict()
Copy link
Member

Choose a reason for hiding this comment

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

Could use a longer name than stim for readability


self.sent = 0
self.echo = 0
self.seqn = seqn
Copy link
Member

Choose a reason for hiding this comment

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

I would change this to seq_num or sequence_number for readability

Also fixed spacing on the column header.
@ThirteenFish ThirteenFish merged commit 42b2897 into master Oct 27, 2024
1 check passed
@ThirteenFish ThirteenFish deleted the ping-output branch October 27, 2024 03:14
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