Skip to content

refactor(rtps): adopt the new Socket option API (set_receive_buffer_size) - #716

Merged
finger563 merged 1 commit into
mainfrom
feat/socket-api-adoption
Aug 15, 2026
Merged

refactor(rtps): adopt the new Socket option API (set_receive_buffer_size)#716
finger563 merged 1 commit into
mainfrom
feat/socket-api-adoption

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Small fast-follow to #714 (the socket set_option / buffer-size API).

A repo-wide sweep for manual setsockopt/getsockopt on native handles found one call site outside the socket component: the RTPS transport's SO_RCVBUF enlarge (used, under RTPS_ENABLE_FRAGMENTATION, to keep a burst of DATA_FRAG datagrams from being dropped before the reactor drains them). This migrates it to the new API:

// before
int rcvbuf = 4 * 1024 * 1024;
::setsockopt(channel.socket->native_handle(), SOL_SOCKET, SO_RCVBUF,
             reinterpret_cast<const char *>(&rcvbuf), sizeof(rcvbuf));
// after
(void)channel.socket->set_receive_buffer_size(4 * 1024 * 1024);

Behaviour is unchanged (still best-effort — failure ignored). No other repo sites needed migrating (the only other SO_* mention is a docstring in the python bindings).

Verified: host lib builds (fragmentation on, so the migrated path is compiled) and rtps_facade_frag passes.

🤖 Generated with Claude Code

…tsockopt

Fast-follow to the socket-option API (#714): the RTPS transport was the only
place in the repo still calling setsockopt() on a raw native handle. Use the new
espp::Socket::set_receive_buffer_size() for the DATA_FRAG receive-buffer enlarge,
dropping the manual native_handle()/SOL_SOCKET/SO_RCVBUF plumbing and its
platform-specific reinterpret_cast. Behaviour is unchanged (still best-effort).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 15, 2026 15:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Refactors RTPS transport socket receive-buffer sizing to use the newer socket option API (set_receive_buffer_size) instead of calling setsockopt on the native handle.

Changes:

  • Replace direct setsockopt(..., SO_RCVBUF, ...) usage with socket->set_receive_buffer_size(...) in the RTPS transport channel setup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread components/rtps/src/communication/EsppTransport.cpp
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@finger563
finger563 merged commit 1eee869 into main Aug 15, 2026
144 checks passed
@finger563
finger563 deleted the feat/socket-api-adoption branch August 15, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants