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

CLI error calculating RTT when any latency point is None #14

Open
RascalTwo opened this issue Oct 1, 2020 · 1 comment · May be fixed by #15
Open

CLI error calculating RTT when any latency point is None #14

RascalTwo opened this issue Oct 1, 2020 · 1 comment · May be fixed by #15

Comments

@RascalTwo
Copy link

When executing the CLI with more then one run, if a single latency_point in the latency_points list is None, then when the last run is reached, an error is thrown:

> tcp_latency example.does.not.exist
tcp-latency example.does.not.exist
example.does.not.exist: tcp seq=0 port=443 timeout=5 failed
example.does.not.exist: tcp seq=1 port=443 timeout=5 failed
example.does.not.exist: tcp seq=2 port=443 timeout=5 failed
example.does.not.exist: tcp seq=3 port=443 timeout=5 failed
example.does.not.exist: tcp seq=4 port=443 timeout=5 failed
--- example.does.not.exist tcp-latency statistics ---
5 packets transmitted
Traceback (most recent call last):
  File "tcp_latency/tcp_latency.py", line 154, in <module>
    _main()
  File "tcp_latency/tcp_latency.py", line 143, in _main
    measure_latency(
  File "tcp_latency/tcp_latency.py", line 91, in measure_latency
    f'rtt min/avg/max = {min(latency_points)}/{mean(latency_points)}/{max(latency_points)} ms',   # noqa: E501
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

None of the three methods - min, mean, or max - are able to accept iterables that contain None.

The behavior is the same when just one of the points are None and the rest are valid floatss.

Due to another issue, the last latency_point is not included in RTT calculations, therefore if only the last point that is None, this error is not thrown.

RascalTwo added a commit to RascalTwo/tcp-latency that referenced this issue Oct 1, 2020
@RascalTwo
Copy link
Author

If you want, I can also solve the last latency_point not being included in RTT calculations issue with this PR too - should only involve moving the

latency_points.append(last_latency_point)

line up before the

if human_output:

line.

@RascalTwo RascalTwo linked a pull request Oct 1, 2020 that will close this issue
RascalTwo added a commit to RascalTwo/tcp-latency that referenced this issue Oct 1, 2020
Fix dgzlopes#14

Signed-off-by: Rascal_Two <therealrascaltwo@gmail.com>
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 a pull request may close this issue.

1 participant