You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stamp every inbound message when its last byte arrives - #179
A message's receive time is when its last byte arrived at the transport. Every inbound message now gets the completion stamp, which the transports pass to end_inbound_message() / end_inbound_fragment(); begin_inbound_message() no longer takes a stamp, and the ESP httpd handler-entry stamp is gone.
Measured on an ESP32 httpd connection: the completion stamp is ~140 us later than the old handler-entry stamp for a server/time reply (a fixed ~70 us offset shift, which GPS ground-truth runs show moves the observed bias in the right direction) and 1 to 5 ms later for an audio chunk, with rare stalls of tens of ms under load. Under ring pressure the httpd stamp also includes any wait for ring space.
No ring header change.
Host (IXWebSocket) delivers whole messages, so both stamps are the same there.
Testing: host ASan + TSan, esp32s3 build. New table test covers each route (ring, fallback, multi-frame into either). Not run on hardware.
A message up to SendspinConnection::SINGLE_SEGMENT_MESSAGE_BYTES keeps the
stamp from when the transport first saw it; a longer one gets the completion
stamp the transport now passes to end_inbound_message().
Always publish completion timestamp after final byte arrival
src/connection.h:904
A payload being small enough to fit one TCP segment does not guarantee that it arrived in one segment: the sender can write the WebSocket header and payload separately, TCP can emit smaller segments, and a transport can deliver multiple chunks. In those cases this heuristic preserves a timestamp from before the last byte arrived, contradicting spec PR 298's requirement that the receive time be the final byte's arrival. Please always publish the completion timestamp in the connection layer; transports that receive a whole message atomically can pass the same value for the start and completion times (as the host paths already do).
Explain rationale for inspecting private timestamp state
tests/test_noise_transport.cpp:2704
This test reads the ring header and pending-message internals without explaining why no caller-visible outcome can distinguish the timestamp path. docs/conventions.md:246-249 requires that rationale whenever tests inspect private state. Please either assert through an observable consumer outcome or document why doing so cannot isolate this transport timestamp behavior.
A message that fits one TCP segment can still arrive in more than one (the
sender may write the header and payload separately), so the first-sight
stamp is dropped: the transport's completion stamp is every message's
receive time, and begin_inbound_message() no longer takes a stamp.
kahrendt
changed the title
Stamp messages longer than one TCP segment when they finish arriving
Stamp every inbound message when its last byte arrives
Oct 7, 2026
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
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.
A message's receive time is when its last byte arrived at the transport. Every inbound message now gets the completion stamp, which the transports pass to
end_inbound_message()/end_inbound_fragment();begin_inbound_message()no longer takes a stamp, and the ESP httpd handler-entry stamp is gone.Measured on an ESP32 httpd connection: the completion stamp is ~140 us later than the old handler-entry stamp for a
server/timereply (a fixed ~70 us offset shift, which GPS ground-truth runs show moves the observed bias in the right direction) and 1 to 5 ms later for an audio chunk, with rare stalls of tens of ms under load. Under ring pressure the httpd stamp also includes any wait for ring space.Testing: host ASan + TSan, esp32s3 build. New table test covers each route (ring, fallback, multi-frame into either). Not run on hardware.
Implements Sendspin/spec#298