Skip to content

Commit 281b645

Browse files
committed
Filter out None points when calculating RTT
Fix dgzlopes#14 Signed-off-by: Rascal_Two <therealrascaltwo@gmail.com>
1 parent 9c39859 commit 281b645

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tcp_latency/tcp_latency.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ def measure_latency(
8686
if i == len(range(runs))-1:
8787
print(f'--- {host} tcp-latency statistics ---')
8888
print(f'{i+1} packets transmitted')
89-
if latency_points:
89+
received_points = [point for point in latency_points if point]
90+
if received_points:
9091
print(
91-
f'rtt min/avg/max = {min(latency_points)}/{mean(latency_points)}/{max(latency_points)} ms', # noqa: E501
92+
f'rtt min/avg/max = {min(received_points)}/{mean(received_points)}/{max(received_points)} ms', # noqa: E501
9293
)
9394

9495
latency_points.append(last_latency_point)

0 commit comments

Comments
 (0)