Skip to content

Reactor consolidation#232

Merged
mvandeberg merged 1 commit intocppalliance:developfrom
mvandeberg:pr/reactor-consolidation
Apr 16, 2026
Merged

Reactor consolidation#232
mvandeberg merged 1 commit intocppalliance:developfrom
mvandeberg:pr/reactor-consolidation

Conversation

@mvandeberg
Copy link
Copy Markdown
Contributor

@mvandeberg mvandeberg commented Apr 15, 2026

Benchmarks

accept_churn

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
burst/10 4.1K 0.8% 4.1K 0.7% -0.1%
burst/100 391 1.3% 389 1.1% -0.5%
burst_lockless/10 4.1K 0.5% 4.0K 1.7% -0.7%
burst_lockless/100 394 0.6% 394 1.3% +0.0%
concurrent/1 33.2K 0.5% 33.2K 0.2% -0.1%
concurrent/4 33.2K 0.6% 33.4K 0.2% +0.6%
concurrent/16 33.1K 0.5% 33.2K 0.3% +0.3%
sequential 33.1K 0.6% 33.3K 0.0% +0.6%
sequential_lockless 33.3K 0.6% 33.4K 0.4% +0.3%

fan_out

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
concurrent_parents/1 7.4K 0.4% 7.4K 0.5% +0.2%
concurrent_parents/4 7.2K 0.2% 7.2K 0.8% +0.3%
concurrent_parents/16 7.0K 0.6% 7.0K 0.5% +0.3%
concurrent_parents_lockless/1 7.4K 0.3% 7.5K 0.4% +0.8%
concurrent_parents_lockless/4 7.2K 0.3% 7.3K 0.6% +0.3%
concurrent_parents_lockless/16 7.1K 0.5% 7.1K 0.5% +0.5%
fork_join/1 102.0K 0.7% 102.3K 0.5% +0.4%
fork_join/4 28.5K 0.6% 28.7K 0.7% +0.7%
fork_join/16 7.4K 0.6% 7.4K 0.6% +0.8%
fork_join/64 1.8K 0.3% 1.8K 0.3% +0.2%
fork_join_lockless/1 103.1K 0.6% 103.6K 0.2% +0.5%
fork_join_lockless/4 28.7K 0.2% 28.9K 0.6% +0.6%
fork_join_lockless/16 7.4K 0.3% 7.4K 0.9% -0.4%
fork_join_lockless/64 1.8K 0.3% 1.8K 0.4% +0.0%
nested/4 7.3K 0.1% 7.3K 1.3% -0.6%
nested/16 1.8K 0.3% 1.8K 1.6% -0.6%
nested_lockless/4 7.4K 0.1% 7.4K 1.3% -0.2%
nested_lockless/16 1.8K 0.4% 1.8K 1.6% -0.2%

http_server

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
concurrent/1 105.7K 0.4% 105.9K 1.0% +0.1%
concurrent/4 113.2K 0.9% 113.4K 0.5% +0.2%
concurrent/16 114.9K 0.4% 114.9K 0.3% +0.1%
concurrent/32 113.9K 0.4% 113.5K 1.0% -0.4%
multithread/1 113.9K 0.2% 114.0K 1.0% +0.1%
multithread/2 214.0K 0.5% 213.5K 0.4% -0.2%
multithread/4 363.2K 2.2% 359.4K 2.1% -1.0%
multithread/8 534.9K 3.9% 534.4K 3.0% -0.1%
multithread/16 556.6K 8.2% 613.1K 19.4% +10.2%
single_conn 105.9K 0.3% 106.0K 0.6% +0.0%
single_conn_lockless 106.9K 0.4% 106.8K 0.5% -0.1%

local_socket_latency

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
concurrent/1 253.9K 3.2% 257.2K 0.8% +1.3%
concurrent/4 278.2K 0.9% 275.0K 0.8% -1.2%
concurrent/16 282.5K 0.7% 279.4K 0.8% -1.1%
concurrent_lockless/1 262.8K 0.7% 255.3K 3.6% -2.8%
concurrent_lockless/4 278.7K 0.5% 277.0K 0.9% -0.6%
concurrent_lockless/16 284.3K 0.1% 282.4K 1.3% -0.7%
pingpong/1 258.3K 1.6% 258.4K 0.5% +0.0%
pingpong/64 260.4K 0.5% 248.5K 3.9% -4.6%
pingpong/1024 253.9K 1.1% 254.3K 0.5% +0.2%
pingpong_lockless/1 260.9K 1.7% 257.7K 2.3% -1.2%
pingpong_lockless/64 253.8K 2.2% 263.2K 0.7% +3.7%
pingpong_lockless/1024 254.8K 4.1% 256.4K 0.4% +0.6%

local_socket_throughput

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
bidirectional/1024 610.0 MB/s 0.6% 605.7 MB/s 1.5% -0.7%
bidirectional/4096 2.01 GB/s 1.8% 1.98 GB/s 0.3% -1.3%
bidirectional/16384 6.57 GB/s 0.5% 6.47 GB/s 0.3% -1.7%
bidirectional/65536 9.41 GB/s 0.4% 9.44 GB/s 0.7% +0.4%
bidirectional/262144 10.97 GB/s 0.8% 11.02 GB/s 0.1% +0.4%
bidirectional/1048576 11.07 GB/s 0.9% 11.00 GB/s 0.2% -0.7%
bidirectional_lockless/1024 608.9 MB/s 0.5% 601.6 MB/s 0.5% -1.2%
bidirectional_lockless/4096 2.01 GB/s 1.0% 2.00 GB/s 0.9% -0.4%
bidirectional_lockless/16384 6.57 GB/s 0.4% 6.52 GB/s 0.5% -0.8%
bidirectional_lockless/65536 9.41 GB/s 1.4% 9.36 GB/s 2.1% -0.5%
bidirectional_lockless/262144 11.08 GB/s 1.3% 11.11 GB/s 0.1% +0.3%
bidirectional_lockless/1048576 11.17 GB/s 1.1% 11.07 GB/s 0.2% -0.9%
unidirectional/1024 589.6 MB/s 0.5% 587.8 MB/s 0.3% -0.3%
unidirectional/4096 1.94 GB/s 1.4% 1.96 GB/s 0.6% +0.8%
unidirectional/16384 6.39 GB/s 1.1% 6.40 GB/s 0.3% +0.1%
unidirectional/65536 9.40 GB/s 2.3% 9.44 GB/s 0.7% +0.5%
unidirectional/262144 10.83 GB/s 12.6% 11.71 GB/s 1.7% +8.1%
unidirectional/1048576 10.77 GB/s 16.9% 11.50 GB/s 3.8% +6.8%
unidirectional_lockless/1024 589.3 MB/s 1.1% 591.8 MB/s 0.1% +0.4%
unidirectional_lockless/4096 1.96 GB/s 1.5% 1.96 GB/s 0.1% +0.4%
unidirectional_lockless/16384 6.42 GB/s 0.4% 6.42 GB/s 0.2% +0.0%
unidirectional_lockless/65536 9.53 GB/s 2.1% 9.47 GB/s 1.4% -0.6%
unidirectional_lockless/262144 11.03 GB/s 9.2% 11.83 GB/s 2.3% +7.3%
unidirectional_lockless/1048576 11.67 GB/s 1.8% 11.50 GB/s 3.8% -1.5%

socket_latency

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
concurrent/1 127.7K 0.4% 128.1K 0.5% +0.3%
concurrent/4 132.3K 0.5% 132.0K 0.3% -0.3%
concurrent/16 133.1K 0.5% 133.6K 0.5% +0.3%
concurrent_lockless/1 128.4K 0.3% 128.8K 0.4% +0.3%
concurrent_lockless/4 132.6K 0.4% 133.2K 0.4% +0.4%
concurrent_lockless/16 133.6K 0.5% 134.4K 0.3% +0.6%
pingpong/1 126.7K 0.9% 127.6K 0.3% +0.7%
pingpong/64 127.6K 0.4% 127.9K 0.3% +0.2%
pingpong/1024 126.1K 0.1% 126.0K 0.5% -0.1%
pingpong_lockless/1 128.2K 0.3% 128.7K 0.4% +0.4%
pingpong_lockless/64 128.4K 0.4% 128.4K 0.5% -0.0%
pingpong_lockless/1024 126.8K 0.5% 127.3K 0.2% +0.4%

socket_throughput

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
bidirectional/1024 263.7 MB/s 0.8% 263.4 MB/s 0.5% -0.1%
bidirectional/4096 1.01 GB/s 0.3% 1.01 GB/s 0.6% -0.1%
bidirectional/16384 3.55 GB/s 0.8% 3.55 GB/s 0.3% -0.1%
bidirectional/65536 8.17 GB/s 7.7% 8.16 GB/s 6.3% -0.1%
bidirectional/262144 10.33 GB/s 0.2% 10.29 GB/s 0.7% -0.4%
bidirectional/1048576 10.71 GB/s 0.5% 10.86 GB/s 0.9% +1.4%
bidirectional_lockless/1024 264.5 MB/s 0.5% 263.3 MB/s 0.7% -0.5%
bidirectional_lockless/4096 1.01 GB/s 0.5% 1.01 GB/s 0.3% -0.1%
bidirectional_lockless/16384 3.53 GB/s 0.8% 3.55 GB/s 0.2% +0.4%
bidirectional_lockless/65536 8.49 GB/s 7.3% 8.52 GB/s 7.6% +0.3%
bidirectional_lockless/262144 10.39 GB/s 1.4% 10.35 GB/s 0.4% -0.4%
bidirectional_lockless/1048576 10.74 GB/s 1.7% 10.86 GB/s 0.6% +1.2%
multithread/2 8.89 GB/s 0.7% 8.90 GB/s 1.0% +0.1%
multithread/4 13.04 GB/s 3.5% 13.41 GB/s 1.4% +2.9%
multithread/8 14.31 GB/s 3.6% 14.67 GB/s 2.8% +2.5%
unidirectional/1024 241.2 MB/s 0.7% 241.9 MB/s 0.6% +0.3%
unidirectional/4096 922.5 MB/s 1.1% 924.1 MB/s 0.7% +0.2%
unidirectional/16384 3.29 GB/s 0.7% 3.31 GB/s 0.2% +0.5%
unidirectional/65536 7.54 GB/s 4.3% 7.62 GB/s 0.6% +1.1%
unidirectional/262144 10.54 GB/s 1.3% 10.50 GB/s 1.0% -0.4%
unidirectional/1048576 10.69 GB/s 0.9% 10.72 GB/s 1.1% +0.3%
unidirectional_lockless/1024 241.4 MB/s 0.4% 241.9 MB/s 0.5% +0.2%
unidirectional_lockless/4096 923.6 MB/s 0.5% 928.4 MB/s 0.2% +0.5%
unidirectional_lockless/16384 3.30 GB/s 0.4% 3.31 GB/s 0.6% +0.4%
unidirectional_lockless/65536 7.56 GB/s 0.4% 7.58 GB/s 0.4% +0.2%
unidirectional_lockless/262144 10.59 GB/s 0.5% 10.63 GB/s 0.2% +0.4%
unidirectional_lockless/1048576 10.79 GB/s 0.8% 10.86 GB/s 0.2% +0.7%

timer

Benchmark Develop avg Develop CV Branch avg Branch CV Delta
concurrent/10 28.5K 0.0% 28.5K 0.0% -0.0%
concurrent/100 251.0K 0.0% 251.0K 0.0% -0.0%
concurrent/1000 2.42M 0.0% 2.43M 0.0% +0.1%
fire_rate 3.49M 0.6% 3.49M 0.5% -0.1%
fire_rate_lockless 3.61M 0.3% 3.59M 0.0% -0.5%
schedule_cancel 52.28M 0.4% 52.38M 0.1% +0.2%
schedule_cancel_lockless 52.32M 0.4% 52.29M 0.3% -0.0%

Summary by CodeRabbit

  • Refactoring
    • Reorganized native reactor backends into a unified, traits-driven architecture for epoll/kqueue/select.
    • Moved many backend-specific implementations into shared CRTP service/socket templates for cleaner lifecycle and registration behavior.
  • New Features
    • Introduced backend traits and consolidated final wrapper types to standardize socket/acceptor behavior across platforms.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

Warning

Rate limit exceeded

@mvandeberg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 42 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 16 minutes and 42 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1475ab92-faaa-4165-83f6-d9d229a97f11

📥 Commits

Reviewing files that changed from the base of the PR and between 893a5dc and 4a81ba6.

📒 Files selected for processing (64)
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_traits.hpp
  • include/boost/corosio/native/detail/epoll/epoll_types.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_traits.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_types.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_backend.hpp
  • include/boost/corosio/native/detail/reactor/reactor_basic_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_op_complete.hpp
  • include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/select/select_scheduler.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_traits.hpp
  • include/boost/corosio/native/detail/select/select_types.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/native_tcp_acceptor.hpp
  • include/boost/corosio/native/native_tcp_socket.hpp
  • include/boost/corosio/native/native_udp_socket.hpp
  • src/corosio/src/io_context.cpp
📝 Walkthrough

Walkthrough

This PR refactors backend implementations into a traits/types-based reactor layer: it removes many per-backend op/service/socket headers (epoll/kqueue/select), adds new backend traits/types, and introduces generic reactor templates and helpers to centralize socket/acceptor/service logic. (49 words)

Changes

Cohort / File(s) Summary
Epoll backend removals
include/boost/corosio/native/detail/epoll/{epoll_op.hpp, epoll_tcp_*.hpp, epoll_udp_*.hpp, epoll_local_*.hpp}
Deleted many epoll-specific op/service/socket/acceptor headers and inline op implementations; removed epoll-specific operation types and socket/acceptor classes.
Epoll backend additions
include/boost/corosio/native/detail/epoll/epoll_traits.hpp, include/boost/corosio/native/detail/epoll/epoll_types.hpp, include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
Added traits-based epoll backend: descriptor_state, policies (write/accept), socket helpers, and consolidated epoll_types wrappers; scheduler now includes epoll_traits instead of epoll_op forward decls.
Kqueue backend removals
include/boost/corosio/native/detail/kqueue/{kqueue_op.hpp, kqueue_tcp_*.hpp, kqueue_udp_*.hpp, kqueue_local_*.hpp}
Deleted many kqueue-specific op/service/socket/acceptor headers and inline op implementations; removed kqueue-specific operation types and socket/acceptor classes.
Kqueue backend additions
include/boost/corosio/native/detail/kqueue/kqueue_traits.hpp, .../kqueue_types.hpp, .../kqueue_scheduler.hpp
Added kqueue_traits (descriptor_state, hooks, policies, helpers) and kqueue_types wrappers; scheduler includes kqueue_traits now.
Select backend removals
include/boost/corosio/native/detail/select/{select_op.hpp, select_tcp_*.hpp, select_udp_*.hpp, select_local_*.hpp}
Deleted many select-specific op/service/socket/acceptor headers and inline op implementations; removed select-specific operation types and socket/acceptor classes.
Select backend additions
include/boost/corosio/native/detail/select/select_traits.hpp, .../select_types.hpp, .../select_scheduler.hpp
Added select_traits (descriptor_state, policies, FD_SETSIZE checks) and select_types wrappers; scheduler includes select_traits now.
Reactor generic additions
include/boost/corosio/native/detail/reactor/{reactor_backend.hpp, reactor_stream_ops.hpp, reactor_datagram_ops.hpp, reactor_socket_finals.hpp, reactor_service_finals.hpp}
Added generic reactor templates and CRTP implementation layers for stream/datagram ops, sockets, acceptors, and shared service helpers (open/assign/init/register logic, accept coroutine backend).
Reactor API adjustments
include/boost/corosio/native/detail/reactor/{reactor_acceptor.hpp, reactor_basic_socket.hpp, reactor_stream_socket.hpp, reactor_datagram_socket.hpp, reactor_acceptor_service.hpp, reactor_socket_service.hpp, reactor_op_complete.hpp, reactor_op_complete.hpp}
Added helper initializers (init_acceptor_fd / init_and_register), moved some constructors to protected, added overridden ImplBase vtable methods (connect/read/write/send/recv/cancel/shutdown), extended register_op with is_write_direction, and added complete_datagram_op overload.
Public header includes updated
include/boost/corosio/native/{native_tcp_socket.hpp, native_tcp_acceptor.hpp, native_udp_socket.hpp}
Replaced conditional includes from per-backend *service.hpp headers to consolidated *_types.hpp headers; no public API surface changes.
Build/source change
src/corosio/src/io_context.cpp
Platform include consolidation to new *_types.hpp headers; runtime service construction calls unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant Acceptor as Reactor Acceptor (CRTP)
  participant Traits as Traits::accept_policy
  participant Kernel as OS (accept/accept4)
  participant Scheduler as Reactor Scheduler
  participant SocketSvc as Stream Service / Socket Final
  participant Continuation as Awaiting Coroutine

  Acceptor->>Traits: call do_accept(fd)
  Traits->>Kernel: sys_accept (accept4 / accept)
  Kernel-->>Traits: fd or errno
  alt accepted fd
    Traits->>Scheduler: register_descriptor(fd)
    Scheduler-->>SocketSvc: create/register socket impl
    SocketSvc-->>Acceptor: set endpoints, set *impl_out, *ec = success
    Acceptor->>Continuation: dispatch continuation (resume)
  else EAGAIN / would-block
    Traits->>Scheduler: work_started / set desc_state.read_op
    Scheduler-->>Acceptor: later readiness triggers op completion
    Acceptor->>Continuation: post completion (resume)
  else error
    Traits->>Acceptor: populate errno -> *ec
    Acceptor->>Continuation: post failure (resume)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

"I dug a tunnel through old headers tight,
Epoll, kqueue, select—lined up in light.
Traits stitched the burrow, reactor hummed on cue,
Sockets sleep easy, coroutines hop through.
🐇✨"

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@cppalliance-bot
Copy link
Copy Markdown

cppalliance-bot commented Apr 15, 2026

An automated preview of the documentation is available at https://232.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-04-16 21:37:30 UTC

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp (1)

690-692: ⚠️ Potential issue | 🟠 Major

Pass the write-direction flag for datagram connect() too.

do_connect() also waits on writability, so leaving is_write_direction at its default false means select schedulers may not interrupt the current select() loop when this op is registered after the fd-set snapshot. That can stall nonblocking datagram connects until an unrelated event arrives.

Suggested fix
     this->register_op(
         op, this->desc_state_.connect_op, this->desc_state_.write_ready,
-        this->desc_state_.connect_cancel_pending);
+        this->desc_state_.connect_cancel_pending, true);

Based on learnings: In the select backend, write/connect ops registered after the snapshot must notify the reactor so the next iteration picks them up in write_fds.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp`
around lines 690 - 692, The datagram connect registration omits the
write-direction flag so the select backend may not wake for connect operations;
update the register_op call in the datagram connect path (the place calling
this->register_op with this->desc_state_.connect_op,
this->desc_state_.write_ready, this->desc_state_.connect_cancel_pending) to pass
is_write_direction=true (matching do_connect’s writability wait) so the
reactor/select backend will mark the op as write-directed and notify the reactor
for correct write_fds handling.
🧹 Nitpick comments (1)
include/boost/corosio/native/detail/kqueue/kqueue_types.hpp (1)

17-28: Place the file overview block after the include block.

The high-level /* */ overview is useful, but this guideline expects it after includes for implementation files with non-trivial logic.

♻️ Suggested placement update
-/* Named per-backend types for the kqueue reactor.
-
-   Each class is a final, named wrapper around the parameterized
-   reactor_*_impl templates. Forward-declarable from backend.hpp
-   so the concrete layer never pulls in platform headers.
-*/
-
 `#include` <boost/corosio/detail/config.hpp>
 `#include` <boost/corosio/native/detail/kqueue/kqueue_traits.hpp>
 `#include` <boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp>
 `#include` <boost/corosio/native/detail/reactor/reactor_backend.hpp>
+
+/* Named per-backend types for the kqueue reactor.
+
+   Each class is a final, named wrapper around the parameterized
+   reactor_*_impl templates. Forward-declarable from backend.hpp
+   so the concrete layer never pulls in platform headers.
+*/

As per coding guidelines: “Files containing non-trivial implementation logic should include a /* */ block comment after the includes that provides a high-level overview…”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/kqueue/kqueue_types.hpp` around lines 17
- 28, Move the top-level block comment that describes "Named per-backend types
for the kqueue reactor" so it appears immediately after the include directives
(the lines including kqueue_traits.hpp, kqueue_scheduler.hpp, and
reactor_backend.hpp) instead of before them; update the file-level overview
placement in kqueue_types.hpp so the /* ... */ overview follows the `#include`
block and precedes the rest of the implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp`:
- Around line 233-242: The current override of do_release_socket() clears
remote_endpoint_ after calling base_type::do_release_socket(), which breaks
established reactor release semantics; update the override in
reactor_stream_socket::do_release_socket() to call
base_type::do_release_socket() and return its fd without modifying
remote_endpoint_, and ensure only reactor_basic_socket resets local_endpoint_
(leave remote_endpoint_ intact) so the cached remote endpoint is preserved
across release().

In `@include/boost/corosio/native/detail/select/select_traits.hpp`:
- Around line 142-152: The current code treats a failed setsockopt(SO_NOSIGPIPE,
...) as fatal by closing new_fd and returning -1; instead make SO_NOSIGPIPE
best-effort in the select backend by ignoring errors from ::setsockopt for
SO_NOSIGPIPE — do not close new_fd or return on failure (optionally log/debug
the errno), and proceed normally after the setsockopt call; apply the same
change to the other SO_NOSIGPIPE branch(s) in select_traits.hpp that handle
new_fd/accept.

---

Outside diff comments:
In `@include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp`:
- Around line 690-692: The datagram connect registration omits the
write-direction flag so the select backend may not wake for connect operations;
update the register_op call in the datagram connect path (the place calling
this->register_op with this->desc_state_.connect_op,
this->desc_state_.write_ready, this->desc_state_.connect_cancel_pending) to pass
is_write_direction=true (matching do_connect’s writability wait) so the
reactor/select backend will mark the op as write-directed and notify the reactor
for correct write_fds handling.

---

Nitpick comments:
In `@include/boost/corosio/native/detail/kqueue/kqueue_types.hpp`:
- Around line 17-28: Move the top-level block comment that describes "Named
per-backend types for the kqueue reactor" so it appears immediately after the
include directives (the lines including kqueue_traits.hpp, kqueue_scheduler.hpp,
and reactor_backend.hpp) instead of before them; update the file-level overview
placement in kqueue_types.hpp so the /* ... */ overview follows the `#include`
block and precedes the rest of the implementation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3da70766-115f-4d50-b2c3-5cd5aeafb10c

📥 Commits

Reviewing files that changed from the base of the PR and between b864679 and 647e610.

📒 Files selected for processing (64)
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_traits.hpp
  • include/boost/corosio/native/detail/epoll/epoll_types.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_traits.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_types.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_backend.hpp
  • include/boost/corosio/native/detail/reactor/reactor_basic_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_op_complete.hpp
  • include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/select/select_scheduler.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_traits.hpp
  • include/boost/corosio/native/detail/select/select_types.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/native_tcp_acceptor.hpp
  • include/boost/corosio/native/native_tcp_socket.hpp
  • include/boost/corosio/native/native_udp_socket.hpp
  • src/corosio/src/io_context.cpp
💤 Files with no reviewable changes (39)
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp

Comment thread include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp Outdated
Comment thread include/boost/corosio/native/detail/select/select_traits.hpp Outdated
@cppalliance-bot
Copy link
Copy Markdown

cppalliance-bot commented Apr 15, 2026

GCOVR code coverage report https://232.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://232.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://232.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-04-16 21:45:36 UTC

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.71%. Comparing base (b864679) to head (4a81ba6).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #232      +/-   ##
===========================================
- Coverage    77.73%   77.71%   -0.02%     
===========================================
  Files           96       96              
  Lines         7306     7298       -8     
  Branches      1787     1787              
===========================================
- Hits          5679     5672       -7     
+ Misses        1109     1108       -1     
  Partials       518      518              
Files with missing lines Coverage Δ
...st/corosio/native/detail/epoll/epoll_scheduler.hpp 82.25% <ø> (-0.15%) ⬇️
.../corosio/native/detail/kqueue/kqueue_scheduler.hpp 69.00% <ø> (-1.10%) ⬇️
.../corosio/native/detail/select/select_scheduler.hpp 83.33% <ø> (ø)
...clude/boost/corosio/native/native_tcp_acceptor.hpp 90.90% <ø> (ø)
include/boost/corosio/native/native_tcp_socket.hpp 90.41% <ø> (ø)
src/corosio/src/io_context.cpp 95.83% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b864679...4a81ba6. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mvandeberg mvandeberg force-pushed the pr/reactor-consolidation branch from 0d4753c to ab7ec63 Compare April 16, 2026 19:01
@mvandeberg mvandeberg marked this pull request as ready for review April 16, 2026 19:15
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp (1)

690-692: ⚠️ Potential issue | 🟠 Major

Wake select when parking datagram connect ops.

connect_op is also a write-side wait in the select backend. Because this call leaves is_write_direction at its default, a UDP/local-datagram connect() that hits EINPROGRESS after select() snapshots write_fds can sit idle until some unrelated event wakes the loop.

Suggested fix
     this->register_op(
         op, this->desc_state_.connect_op, this->desc_state_.write_ready,
-        this->desc_state_.connect_cancel_pending);
+        this->desc_state_.connect_cancel_pending, true);

Based on learnings: In the select backend, write/connect ops registered after the snapshot must call notify_reactor() so the next iteration picks them up in write_fds.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp`
around lines 690 - 692, The connect_op is a write-side wait in the select
backend and must wake the select loop if registered after its snapshot; update
the registration code around register_op(op, this->desc_state_.connect_op,
this->desc_state_.write_ready, this->desc_state_.connect_cancel_pending) so that
after registering a write/connect op you call notify_reactor() (or set the
is_write_direction flag to true when calling register_op if that overload
exists) — specifically ensure the path that registers desc_state_.connect_op
triggers notify_reactor() so the next select iteration includes the new
write_fds.
🧹 Nitpick comments (3)
include/boost/corosio/native/detail/reactor/reactor_backend.hpp (1)

94-100: Consider a more descriptive error than ENOENT for a missing stream service.

A null stream_service() here indicates an internal service-wiring bug (per existing learnings, io_context always co-creates socket and acceptor services, so this branch should be unreachable in practice). ENOENT ("no such file or directory") is a confusing choice to surface to user code for what is effectively an invariant violation. Consider EINVAL, ENOPROTOOPT, or a library-specific capy::error::... value to make debugging easier if this branch ever does fire.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/reactor/reactor_backend.hpp` around lines
94 - 100, The branch that sets *ec = make_err(ENOENT) when stream_service() is
null should use a more descriptive error to indicate an internal
service-wiring/invariant violation; replace ENOENT with a clearer errno or
library-specific error (e.g. EINVAL or a dedicated
capy::error::internal_service_error) in the reactor_backend.hpp code path that
handles accepted sockets (references: stream_service(), make_err(), accepted,
impl_out, ec) so callers see an explicit "internal service missing" error rather
than "no such file or directory."
include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp (2)

73-128: Consider documenting do_assign_fd fd ownership on failure.

On success this function registers fd with the impl (line 105). On the early validation failures (lines 86-98), fd has not yet been adopted, so the caller retains ownership — but close_socket() at line 80 has already dropped the impl's previous fd, leaving it "empty". This contract (adopt on success; impl emptied on failure; caller always owns the passed fd until success) is non-obvious. A brief comment at the top, or an invariant note, would help future maintainers. Also note: if configure_local_socket(fd) at line 101 fails after line 80, we've already torn down the old fd without adopting the new one; confirm that's the intended observable state.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp`
around lines 73 - 128, Add a short invariant comment at the top of do_assign_fd
describing ownership semantics: after calling socket_impl->close_socket() the
impl's previous fd is released/emptied and the passed fd remains owned by the
caller until socket_impl->init_and_register(fd) succeeds; on any early
validation failure (getsockname/getsockopt) or if
Traits::configure_local_socket(fd) fails, the caller retains ownership of fd and
the impl remains empty. Also add a sentence noting that configure_local_socket
failure leaves the impl without a bound fd (intended observable state), and
reference the key symbols do_assign_fd, socket_impl->close_socket(),
Traits::configure_local_socket, and socket_impl->init_and_register in the
comment so future maintainers can find the relevant code paths.

197-205: Inconsistent hook lifecycle wiring between TCP and local-stream services.

reactor_tcp_service_impl exposes pre_shutdown/pre_destroy that forward to impl->hook_, but reactor_local_stream_service_impl (lines 212-248) does not — even though both use Traits::stream_socket_hook (see reactor_socket_finals.hpp:79-97). The local-stream backends compensate ad-hoc inside release_socket() overrides (e.g. hook_ = {} in kqueue_local_stream_socket/epoll_local_stream_socket), which is asymmetric. Worth either centralizing these hooks in a common base or adding the same forwarders here for consistency and to avoid future backends forgetting one path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp`
around lines 197 - 205, The local-stream service lacks the same hook lifecycle
forwarders as TCP: add pre_shutdown and pre_destroy forwarding methods for
reactor_local_stream_service_impl that call
impl->hook_.pre_shutdown(impl->native_handle()) and
impl->hook_.pre_destroy(impl->native_handle()) (matching the signatures and
noexcept of the TCP versions), or alternatively move those forwarders into the
shared reactor socket base so both reactor_tcp_service_impl and
reactor_local_stream_service_impl use the same implementation; ensure you remove
ad-hoc hook clearing in release_socket() overrides (kqueue_local_stream_socket /
epoll_local_stream_socket) once centralized to avoid double-handling and keep
Traits::stream_socket_hook semantics consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@include/boost/corosio/native/detail/reactor/reactor_backend.hpp`:
- Around line 66-112: The inline-budget branch in the accept logic fails to
protect the acceptor lifetime: before returning from the if-branch that calls
dispatch_coro(ex, op.cont_op.cont) you must set op.impl_ptr =
this->shared_from_this() (same pattern used on the async/EAGAIN and post paths)
so the acceptor (this / acc_) is kept alive while the continuation returned by
dispatch_coro may be dispatched asynchronously; add that assignment immediately
prior to the dispatch_coro return in the same block that configures impl and ec.

---

Outside diff comments:
In `@include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp`:
- Around line 690-692: The connect_op is a write-side wait in the select backend
and must wake the select loop if registered after its snapshot; update the
registration code around register_op(op, this->desc_state_.connect_op,
this->desc_state_.write_ready, this->desc_state_.connect_cancel_pending) so that
after registering a write/connect op you call notify_reactor() (or set the
is_write_direction flag to true when calling register_op if that overload
exists) — specifically ensure the path that registers desc_state_.connect_op
triggers notify_reactor() so the next select iteration includes the new
write_fds.

---

Nitpick comments:
In `@include/boost/corosio/native/detail/reactor/reactor_backend.hpp`:
- Around line 94-100: The branch that sets *ec = make_err(ENOENT) when
stream_service() is null should use a more descriptive error to indicate an
internal service-wiring/invariant violation; replace ENOENT with a clearer errno
or library-specific error (e.g. EINVAL or a dedicated
capy::error::internal_service_error) in the reactor_backend.hpp code path that
handles accepted sockets (references: stream_service(), make_err(), accepted,
impl_out, ec) so callers see an explicit "internal service missing" error rather
than "no such file or directory."

In `@include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp`:
- Around line 73-128: Add a short invariant comment at the top of do_assign_fd
describing ownership semantics: after calling socket_impl->close_socket() the
impl's previous fd is released/emptied and the passed fd remains owned by the
caller until socket_impl->init_and_register(fd) succeeds; on any early
validation failure (getsockname/getsockopt) or if
Traits::configure_local_socket(fd) fails, the caller retains ownership of fd and
the impl remains empty. Also add a sentence noting that configure_local_socket
failure leaves the impl without a bound fd (intended observable state), and
reference the key symbols do_assign_fd, socket_impl->close_socket(),
Traits::configure_local_socket, and socket_impl->init_and_register in the
comment so future maintainers can find the relevant code paths.
- Around line 197-205: The local-stream service lacks the same hook lifecycle
forwarders as TCP: add pre_shutdown and pre_destroy forwarding methods for
reactor_local_stream_service_impl that call
impl->hook_.pre_shutdown(impl->native_handle()) and
impl->hook_.pre_destroy(impl->native_handle()) (matching the signatures and
noexcept of the TCP versions), or alternatively move those forwarders into the
shared reactor socket base so both reactor_tcp_service_impl and
reactor_local_stream_service_impl use the same implementation; ensure you remove
ad-hoc hook clearing in release_socket() overrides (kqueue_local_stream_socket /
epoll_local_stream_socket) once centralized to avoid double-handling and keep
Traits::stream_socket_hook semantics consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d837de37-f428-495c-bb59-9bda0d05afde

📥 Commits

Reviewing files that changed from the base of the PR and between 0d4753c and ab7ec63.

📒 Files selected for processing (64)
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_traits.hpp
  • include/boost/corosio/native/detail/epoll/epoll_types.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_traits.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_types.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_backend.hpp
  • include/boost/corosio/native/detail/reactor/reactor_basic_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_op_complete.hpp
  • include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/select/select_scheduler.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_traits.hpp
  • include/boost/corosio/native/detail/select/select_types.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/native_tcp_acceptor.hpp
  • include/boost/corosio/native/native_tcp_socket.hpp
  • include/boost/corosio/native/native_udp_socket.hpp
  • src/corosio/src/io_context.cpp
💤 Files with no reviewable changes (39)
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp
✅ Files skipped from review due to trivial changes (6)
  • include/boost/corosio/native/detail/select/select_scheduler.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp
  • src/corosio/src/io_context.cpp
  • include/boost/corosio/native/native_udp_socket.hpp
  • include/boost/corosio/native/native_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_ops.hpp
🚧 Files skipped from review as they are similar to previous changes (7)
  • include/boost/corosio/native/native_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_traits.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_ops.hpp

Comment thread include/boost/corosio/native/detail/reactor/reactor_backend.hpp
@mvandeberg mvandeberg force-pushed the pr/reactor-consolidation branch from ab7ec63 to 893a5dc Compare April 16, 2026 20:50
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
include/boost/corosio/native/detail/epoll/epoll_types.hpp (2)

85-112: Consider a dedicated no_acceptor placeholder instead of epoll_tcp_acceptor for datagram wrappers.

Both epoll_udp_socket (Line 88) and epoll_local_datagram_socket (Line 102/107) pass epoll_tcp_acceptor as the DummyAcc template argument to reactor_dgram_socket_impl. Datagrams have no acceptor, and reusing the TCP acceptor type here is semantically misleading (especially for the local-datagram case, where it also couples UDP-unrelated types into the instantiation). A small empty placeholder type (e.g., struct no_acceptor {};) exposed from the reactor layer would make intent explicit and avoid spurious cross-type coupling in generated symbol names.

Not blocking — purely a readability/maintainability nit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/epoll/epoll_types.hpp` around lines 85 -
112, The datagram socket specializations epoll_udp_socket and
epoll_local_datagram_socket currently pass epoll_tcp_acceptor as the DummyAcc
template parameter which is semantically incorrect and couples TCP types into
datagram symbols; define a small empty placeholder type (e.g., struct
no_acceptor {}) in the reactor layer and replace epoll_tcp_acceptor with that
placeholder in the template instantiations for reactor_dgram_socket_impl used by
epoll_udp_socket and epoll_local_datagram_socket, and update any related
forward/declaration uses so the new no_acceptor is exposed where
reactor_dgram_socket_impl is instantiated.

76-128: Make release_socket() consistent between local stream and local datagram.

epoll_local_stream_socket::release_socket() resets hook_ = {}; before delegating, while epoll_local_datagram_socket::release_socket() does not. For the current epoll_traits::stream_socket_hook (stateless) this is a no-op either way, but the asymmetry will silently diverge if the hook ever gains per-socket state (e.g., mirroring BSD SO_NOSIGPIPE tracking in kqueue). Consider aligning both overrides — either both reset hook_, or neither does and the base handles it.

♻️ Proposed change
     native_handle_type release_socket() noexcept override
     {
+        hook_ = {};
         return this->do_release_socket();
     }
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/epoll/epoll_types.hpp` around lines 76 -
128, The two release_socket overrides are inconsistent:
epoll_local_stream_socket::release_socket() clears hook_ (hook_ = {}) before
calling do_release_socket(), but epoll_local_datagram_socket::release_socket()
does not; make them consistent by clearing hook_ in
epoll_local_datagram_socket::release_socket() as well (or alternatively remove
the clear from the stream override and move the hook reset into the shared
do_release_socket() implementation) so both epoll_local_stream_socket and
epoll_local_datagram_socket behave identically with respect to
stream_socket_hook state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp`:
- Around line 104-106: The change calls Traits::configure_local_socket(fd)
inside assign_socket(), which mutates caller-owned flags; restore adopt-only
semantics by removing that call for local descriptors: in the assign_socket()
implementation in reactor_service_finals.hpp, either delete the std::error_code
ec = Traits::configure_local_socket(fd); if (ec) return ec; lines or wrap them
behind a check so they run only for non-local sockets (i.e., skip calling
Traits::configure_local_socket(fd) when assigning a local stream/datagram fd),
leaving assign_socket() as a pure adoption operation.

In `@include/boost/corosio/native/detail/reactor/reactor_socket_finals.hpp`:
- Around line 71-73: The member-initializers for the derived templates use
invalid syntax like reactor_stream_socket_impl::reactor_stream_socket(...);
change them to initialize the base via a typedef/using alias and then call that
alias in the mem-init. For example, inside class reactor_stream_socket_impl add
a using base_type = reactor_stream_socket; (or similar unique alias) and replace
the initializer reactor_stream_socket_impl::reactor_stream_socket(svc) with
base_type(svc); apply the same pattern for the other constructors/members that
currently use Derived::Base(...) so the compiler sees a proper base-type
initializer.

---

Nitpick comments:
In `@include/boost/corosio/native/detail/epoll/epoll_types.hpp`:
- Around line 85-112: The datagram socket specializations epoll_udp_socket and
epoll_local_datagram_socket currently pass epoll_tcp_acceptor as the DummyAcc
template parameter which is semantically incorrect and couples TCP types into
datagram symbols; define a small empty placeholder type (e.g., struct
no_acceptor {}) in the reactor layer and replace epoll_tcp_acceptor with that
placeholder in the template instantiations for reactor_dgram_socket_impl used by
epoll_udp_socket and epoll_local_datagram_socket, and update any related
forward/declaration uses so the new no_acceptor is exposed where
reactor_dgram_socket_impl is instantiated.
- Around line 76-128: The two release_socket overrides are inconsistent:
epoll_local_stream_socket::release_socket() clears hook_ (hook_ = {}) before
calling do_release_socket(), but epoll_local_datagram_socket::release_socket()
does not; make them consistent by clearing hook_ in
epoll_local_datagram_socket::release_socket() as well (or alternatively remove
the clear from the stream override and move the hook reset into the shared
do_release_socket() implementation) so both epoll_local_stream_socket and
epoll_local_datagram_socket behave identically with respect to
stream_socket_hook state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 556747ba-9c3b-48da-84b5-4c1d076af245

📥 Commits

Reviewing files that changed from the base of the PR and between ab7ec63 and 893a5dc.

📒 Files selected for processing (64)
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_traits.hpp
  • include/boost/corosio/native/detail/epoll/epoll_types.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_traits.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_types.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_backend.hpp
  • include/boost/corosio/native/detail/reactor/reactor_basic_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_datagram_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_op_complete.hpp
  • include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_finals.hpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_service.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_ops.hpp
  • include/boost/corosio/native/detail/reactor/reactor_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/select/select_scheduler.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_traits.hpp
  • include/boost/corosio/native/detail/select/select_types.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/native_tcp_acceptor.hpp
  • include/boost/corosio/native/native_tcp_socket.hpp
  • include/boost/corosio/native/native_udp_socket.hpp
  • src/corosio/src/io_context.cpp
💤 Files with no reviewable changes (39)
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_socket.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_op.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_acceptor.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_service.hpp
  • include/boost/corosio/native/detail/select/select_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_service.hpp
  • include/boost/corosio/native/detail/select/select_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_op.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_udp_socket.hpp
  • include/boost/corosio/native/detail/select/select_udp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_udp_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_local_stream_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_datagram_socket.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_local_stream_service.hpp
  • include/boost/corosio/native/detail/select/select_udp_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_tcp_acceptor_service.hpp
✅ Files skipped from review due to trivial changes (6)
  • include/boost/corosio/native/detail/kqueue/kqueue_scheduler.hpp
  • include/boost/corosio/native/detail/select/select_scheduler.hpp
  • include/boost/corosio/native/native_tcp_socket.hpp
  • include/boost/corosio/native/native_tcp_acceptor.hpp
  • src/corosio/src/io_context.cpp
  • include/boost/corosio/native/detail/reactor/reactor_socket_service.hpp
🚧 Files skipped from review as they are similar to previous changes (8)
  • include/boost/corosio/native/detail/reactor/reactor_acceptor_service.hpp
  • include/boost/corosio/native/detail/epoll/epoll_scheduler.hpp
  • include/boost/corosio/native/native_udp_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_basic_socket.hpp
  • include/boost/corosio/native/detail/reactor/reactor_acceptor.hpp
  • include/boost/corosio/native/detail/reactor/reactor_op_complete.hpp
  • include/boost/corosio/native/detail/epoll/epoll_traits.hpp
  • include/boost/corosio/native/detail/kqueue/kqueue_types.hpp

Comment thread include/boost/corosio/native/detail/reactor/reactor_service_finals.hpp Outdated
The epoll, kqueue, and select backends each had 13 nearly-identical
per-protocol files for the socket, service, and acceptor types of
TCP, UDP, and Unix stream/datagram. Replace those 39 files with
shared parameterized templates plus per-backend traits and types
files, dropping each backend from 14 files (the 13 plus the
scheduler) to 3 (scheduler, traits, types).

New per-backend files:
- {backend}_traits.hpp: platform-specific behavior (socket creation
  flags, write and accept policies, fd configuration, stream socket
  hook for SO_LINGER, descriptor_state)
- {backend}_types.hpp: named final classes that instantiate the
  shared templates

New shared templates in detail/reactor/:
- reactor_stream_ops.hpp and reactor_datagram_ops.hpp: parameterized
  op types
- reactor_socket_finals.hpp: reactor_stream_socket_impl,
  reactor_dgram_socket_impl, reactor_acceptor_impl
- reactor_service_finals.hpp: per-protocol service implementations
  plus do_open_socket, do_assign_fd, and do_open_acceptor helpers
- reactor_backend.hpp: the accept() method body, which needs all
  the named types to be complete

The existing reactor base templates (reactor_basic_socket,
reactor_stream_socket, reactor_datagram_socket, reactor_acceptor)
gain ImplBase and Endpoint template parameters so a single
template works for both IP and Unix domain sockets.

io_context.cpp and the native/ tcp_socket, tcp_acceptor, and
udp_socket headers switch to including {backend}_types.hpp in
place of the individual service headers.
@mvandeberg mvandeberg force-pushed the pr/reactor-consolidation branch from 893a5dc to 4a81ba6 Compare April 16, 2026 21:34
@mvandeberg mvandeberg merged commit 3fc8c97 into cppalliance:develop Apr 16, 2026
42 checks passed
@mvandeberg mvandeberg deleted the pr/reactor-consolidation branch April 16, 2026 22:46
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