Repository navigation
Add retained TCP payload sends - #122
Merged
Merged
Conversation
Let the TCP connection retain each payload until the kernel releases its pages. Keep wire framing and the existing copy path available, and expose submitted, completed, and copied-send totals. Test partial writes, completion ranges, abort, and a public retained stream round trip.
Every closed TCP connection printed its retained-send totals to stdout, in every application that links XLink. XLinkGetRetainedSendStats gives a caller the same numbers, so the close-time line moves to the debug log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI runs ctest in the build directory, which had no CTestTestfile because only tests/ enabled testing, so every job printed "No tests were found" and passed without running a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moratom
changed the base branch from
feat/rvc2ng-receive-memory
to
rvc2ng_develop
November 12, 2026 00:54
rtt_test failed when any one of its 10000 local round trips took over 5 ms. Now that CI runs the tests, the shared macOS and Windows runners preempt a few of them: the failing jobs saw 5 samples between 5 and 43 ms, the rest far below. Nagle's algorithm or a delayed ACK, which the test guards against, slows every round trip, so the median catches them: with TCP_NODELAY and TCP_QUICKACK removed, the test does not finish within 300 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moratom
pushed a commit
to luxonis/depthai-core
that referenced
this pull request
Nov 12, 2026
XLink#122 gained a test fix: rtt_test judges its median round trip, so XLink's CI, which now runs the tests, passes on macOS and Windows. The library is unchanged from the previous pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
@moratom - just a question, given XLinkWriteData is already blocking, do we need new/explicit API for this behavior? |
Collaborator
Author
Good point, not in the happy path at least. The agent opted for a separate API for less risk & for the case of failure in case XLinkWriteData returns due to an error, where linux might still be reading the frame. Safer to have a new flag / new function for now to avoid silently changing this on RVC4 / Core. |
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.
Purpose
Allow XLink callers to send a shared payload over TCP while keeping its storage alive for the kernel, so a device can send camera frames over Ethernet without copying them.
Specification
Add an opt-in retained write with an owner release callback (
XLinkWriteDataRetained) and the connection's totals (XLinkGetRetainedSendStats). Linux uses boundedMSG_ZEROCOPYsubmissions and reaps error-queue completions. Control bytes, unsupported sockets and older kernels keep the existing copy behavior. The wire format stays compatible with existing peers.Dependencies & Potential Impact
The caller keeps payload bytes immutable until the release callback. If an aborted socket cannot drain, XLink keeps the outstanding leases and disables further zero-copy submissions for the process. Existing callers are unchanged.
This PR targets
rvc2ng_develop, the long-running branch that depthai-core'srvc2ng_developpins.Deployment Plan
Callers opt in per write. Existing callers continue to use
XLinkWriteData. depthai-core moves its XLink pin in a separate PR.Testing & Validation
fix(tests): enable CTest at the top level: CI ranctestin the build directory, which found no tests ("No tests were found" in every job), so no XLink test had run in CI. The tests now run in every job.fix(tests): judge rtt_test by its median round trip: with the tests running,rtt_testfailed on the shared macOS and Windows runners whenever one of its 10000 local round trips took over 5 ms (5 samples of 5-43 ms in a failing job). It now judges the median, which Nagle's algorithm or a delayed ACK still breaks: withTCP_NODELAYandTCP_QUICKACKremoved it does not finish in 300 s. CI passes on every job of the matrix.tcp_retained_send_test,retained_stream_testandretained_stream_reset_test.MSG_ZEROCOPYunavailable; the zero-copy test skips in that configuration.AI Usage
Assisted by OpenAI Codex and Claude Code.
🤖 Generated with Claude Code