Skip to content

feat: add TCP connection latency (RTT) measurement - #1228

Closed
LeandroPG19 wants to merge 1 commit into
GyulyVGC:mainfrom
LeandroPG19:feat/tcp-latency-rtt
Closed

feat: add TCP connection latency (RTT) measurement#1228
LeandroPG19 wants to merge 1 commit into
GyulyVGC:mainfrom
LeandroPG19:feat/tcp-latency-rtt

Conversation

@LeandroPG19

Copy link
Copy Markdown
Contributor

Summary

Implements latency (RTT) measurement for TCP connections as requested in #845.

How it works

Measures the Round-Trip Time from the TCP handshake: when a SYN packet is captured, its pcap timestamp is stored. When the matching SYN-ACK arrives, the difference between the two timestamps gives the RTT. The latency is then displayed in milliseconds on the connection details page.

Changes

File What
src/networking/parse_packets.rs Track pending SYN timestamps in a HashMap. On SYN-ACK, compute RTT via compute_rtt() helper. Clone LaxPacketHeaders to access TCP flags after analyze_headers.
src/networking/manage_packets.rs modify_or_insert_in_map accepts latency: Option<Duration> and stores it on InfoAddressPortPair.
src/networking/types/info_address_port_pair.rs New latency: Option<Duration> field. refresh() preserves existing latency unless a new one arrives.
src/gui/pages/connection_details_page.rs Display "Latency: X.X ms" when available.
src/translations/translations_5.rs latency_translation() in 16 languages.

Tests

9 new tests added (180 total, all passing):

  • test_compute_rtt_basic β€” simple RTT within same second
  • test_compute_rtt_crossing_second β€” RTT crossing second boundary
  • test_compute_rtt_large_gap β€” multi-second RTT
  • test_compute_rtt_zero β€” zero RTT (same timestamp)
  • test_compute_rtt_negative_returns_none β€” inverted timestamps β†’ None
  • test_compute_rtt_display_ms β€” display format "25.0 ms"
  • test_latency_default_is_none β€” default is None
  • test_latency_refresh_overwrites_when_some β€” refresh overwrites when new value present
  • test_latency_refresh_preserves_when_other_none β€” refresh preserves when no new value
running 180 tests
test result: ok. 180 passed; 0 failed; 0 ignored; 0 measured

Closes #845

Measure Round-Trip Time from TCP SYN/SYN-ACK handshake timestamps.
Display latency in milliseconds on the connection details page.

Closes GyulyVGC#845
@LeandroPG19
LeandroPG19 force-pushed the feat/tcp-latency-rtt branch from 3c425ec to fa23acc Compare July 6, 2026 17:37
@GyulyVGC

Copy link
Copy Markdown
Owner

Thanks but this is already being implemented with ICMP pings in #1194

@GyulyVGC GyulyVGC closed this Jul 13, 2026
@GyulyVGC GyulyVGC added the wontfix This will not be worked on label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Show latency of connections

2 participants