feat: add TCP connection latency (RTT) measurement - #1228
Closed
LeandroPG19 wants to merge 1 commit into
Closed
Conversation
Measure Round-Trip Time from TCP SYN/SYN-ACK handshake timestamps. Display latency in milliseconds on the connection details page. Closes GyulyVGC#845
LeandroPG19
force-pushed
the
feat/tcp-latency-rtt
branch
from
July 6, 2026 17:37
3c425ec to
fa23acc
Compare
Owner
|
Thanks but this is already being implemented with ICMP pings in #1194 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
src/networking/parse_packets.rscompute_rtt()helper. CloneLaxPacketHeadersto access TCP flags afteranalyze_headers.src/networking/manage_packets.rsmodify_or_insert_in_mapacceptslatency: Option<Duration>and stores it onInfoAddressPortPair.src/networking/types/info_address_port_pair.rslatency: Option<Duration>field.refresh()preserves existing latency unless a new one arrives.src/gui/pages/connection_details_page.rssrc/translations/translations_5.rslatency_translation()in 16 languages.Tests
9 new tests added (180 total, all passing):
test_compute_rtt_basicβ simple RTT within same secondtest_compute_rtt_crossing_secondβ RTT crossing second boundarytest_compute_rtt_large_gapβ multi-second RTTtest_compute_rtt_zeroβ zero RTT (same timestamp)test_compute_rtt_negative_returns_noneβ inverted timestamps β Nonetest_compute_rtt_display_msβ display format "25.0 ms"test_latency_default_is_noneβ default is Nonetest_latency_refresh_overwrites_when_someβ refresh overwrites when new value presenttest_latency_refresh_preserves_when_other_noneβ refresh preserves when no new valueCloses #845