⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@sgerbino
Copy link
Collaborator

No description provided.

vinniefalco and others added 30 commits January 13, 2026 04:17
- Add boost_corosio_wolfssl library target
- Add CMake FindWolfSSL module and build configuration
- Add B2 wolfssl.jam module and Jamfile configuration
- Library is optional; builds only when WolfSSL is found
- Replace generic tls_stream with wolfssl_stream for clarity

- Add virtual destructor to io_object base class

- Add WolfSSL context documentation

- Update includes and documentation navigation
…example

- wolfssl_stream now takes io_stream& reference instead of owning the stream
- Refactor http_client do_request to accept io_stream& for reuse with TLS
- Fix buffer handling: use std::array passed by value into coroutine frames
- Add https-client example demonstrating TLS connections
- Remove async_mutex and inline I/O operations directly

- Fix handshake to flush output before reading (required for TLS sequence)

- Add SNI support and disable cert verification for testing

- Update https_client with hostname parameter and error handling
- Add ctx_ member and context() accessor to io_object
- Add explicit constructor taking execution_context&
- Update io_stream to derive with context parameter
- Update socket, acceptor, wolfssl_stream to use base class
- Move io_stream_impl to public section for visibility
- Update includes from boost/capy/*.hpp to boost/capy/ex/*.hpp for:
  any_dispatcher, async_mutex, async_run, coro, execution_context
- Update includes from boost/capy/*.hpp to boost/capy/core/*.hpp for:
  intrusive_list, intrusive_queue, thread_local_ptr
- Update includes in headers, sources, examples, and documentation
- Update includes from coro.hpp to any_coro.hpp
- Update all capy::coro usages to capy::any_coro
- Update scheduler interface to use any_coro
- Update io_context executor dispatch/post/defer signatures
- Update win_iocp_scheduler and win_iocp_sockets
- Update overlapped_op coroutine handle member
- Update wolfssl_stream dispatcher calls
- Update io_context test coroutine conversion operators
- Update design-rationale.adoc example
- Add resolver class with resolve() awaitable returning io_result<resolver_results>
- Add resolver_results and resolver_entry for holding DNS resolution results
- Add resolve_flags enum for controlling resolution behavior
- Implement win_iocp_resolver_service using GetAddrInfoExW for async DNS
- Require Windows 8+ SDK (_WIN32_WINNT >= 0x0602) for GetAddrInfoExW
- Add nslookup example demonstrating resolver usage
- Add posix_scheduler.hpp with class declaration using std::mutex/condition_variable
- Add posix_scheduler.cpp implementing run/post/poll methods with thread-safe work tracking
- Update io_context.cpp to use posix_scheduler instead of reactive_scheduler on non-Windows
- Fix resolver_impl access by making it public (fixes build error)
- Add virtual do_cancel() hook to overlapped_op base class
- Implement accept_op::do_cancel() calling CancelIoEx on listen socket
- Wire canceller to invoke do_cancel() after request_cancel()

feat: implement cancellation for read and write socket operations

- Add do_cancel() implementation for read_op using CancelIoEx
- Add do_cancel() implementation for write_op using CancelIoEx
- Add win_socket_impl reference to read_op and write_op structs
- Initialize read and write operations with socket impl in constructor

fix: add cancellation support for Windows socket connect

- Add impl reference and do_cancel() override to connect_op struct
- Implement connect_op::do_cancel() calling CancelIoEx on the socket
- Initialize conn_ member with socket impl reference in constructor

chore: relocate sources and add build presets

- move implementation sources under src/corosio/src and adjust build files
- add CMakePresets.json default Ninja configure to out/build
- note portable capy::cond comparisons in docs and public API comments
- refresh ignore rules to keep build scripts while ignoring outputs
- Add do_cancel() implementation for read_op using CancelIoEx
- Add do_cancel() implementation for write_op using CancelIoEx
- Add win_socket_impl reference to read_op and write_op structs
- Initialize read and write operations with socket impl in constructor
- Add do_cancel() implementation for read_op using CancelIoEx
- Add do_cancel() implementation for write_op using CancelIoEx
- Add win_socket_impl reference to read_op and write_op structs
- Initialize read and write operations with socket impl in constructor
- Let Windows SDK headers determine the default target version
vinniefalco and others added 27 commits January 19, 2026 15:10
* namespac etls
* Portable tls::context
* OpenSSL implementation and library
* WolfSSL and OpenSSL adopt tls::context data
- Add socket_pair.hpp header declaring make_socket_pair function
- Add socket_pair.cpp implementation using loopback TCP connection
- Add unit tests for socket pair creation and bidirectional I/O
This commit addresses several correctness and portability issues in the
epoll backend and TLS implementations.

epoll completion/cancellation race:
- Add atomic `registered` flag to epoll_op as a claim token
- Scheduler and cancel() now race to atomically exchange the flag
- Whoever wins owns the completion, preventing double-completion bugs
- cancel() properly unregisters fd from epoll and posts to completion queue
- close_socket() calls cancel() first to ensure pending ops complete

SIGPIPE handling:
- Replace writev() with sendmsg() using MSG_NOSIGNAL flag
- Matches Boost.Asio's per-syscall approach instead of global signal handler
- Avoids process-wide side effects from signal(SIGPIPE, SIG_IGN)

Empty buffer handling:
- Extend checks to handle single zero-length buffers, not just empty iovec

WolfSSL deferred context initialization:
- Cache separate client_ctx_ and server_ctx_ in wolfssl_native_context
- Defer SSL object creation until handshake when role is known
- Works with standard WolfSSL builds without --enable-opensslextra
- Single tls::context can now be shared across client and server streams

TLS test lambda capture fix:
- Store coroutine lambdas in named variables before invocation
- Fixes dangling reference when temporary lambda is destroyed before
  coroutine completes, which caused client/server to share captures

Add high-level overview comments to epoll implementation files explaining
architecture, completion/cancellation race handling, and design rationale.
- Replace throwing/error_code overload pairs with
  system::result<void>
  - Replace multiple signal constructors with variadic
  template
  - Add error checking for signal() calls when restoring
  SIG_DFL
  - Fix signal validation to allow signal 0
Replace the POSIX signal() implementation with sigaction() and add
support for signal flags (SA_RESTART, SA_NOCLDSTOP, etc.) while
keeping OS-specific headers out of the public API.

Public API changes:

  - Add flags_t enum directly to signal_set with abstract bit values
  - Add signal_set::add(int, flags_t) overload
  - Existing add(int) becomes inline convenience calling add(signal, none)
  - Add bitwise operators for flag manipulation (|, &, |=, &=, ~)

Available flags: none, restart, no_child_stop, no_child_wait, no_defer,
reset_handler, dont_care

POSIX implementation (posix/signals.cpp):

  - Replace signal() with sigaction() for robust signal handling
  - Add flags_supported() to validate flags available on this platform
  - Add to_sigaction_flags() to map abstract flags to SA_* constants
  - Add flag conflict detection for multiple signal_sets on same signal
  - Remove handler re-registration (not needed with sigaction)
  - Track registered flags in global signal_state for cross-set validation
  - Return operation_not_supported if SA_NOCLDWAIT unavailable
  - Document async-signal-safety limitation in signal handler

Windows implementation (win/signals.cpp):

  - Only none and dont_care flags are supported
  - Other flags return operation_not_supported

Testing: Cross-platform tests for none/dont_care, POSIX-only tests for
actual flag behavior, Windows-only test for operation_not_supported.
Implement a single reactor thread coordination model for the epoll
scheduler, matching Windows IOCP semantics for handler parallelism.

The original epoll scheduler had all threads block on epoll_wait()
simultaneously. When wakeup() was called, the eventfd write caused
ALL waiting threads to wake up, but only one had actual work.

The new single reactor model:
- ONE thread runs epoll_wait() at a time (the reactor)
- OTHER threads wait on a condition variable for handler work
- notify_one() wakes exactly one worker when handlers are posted
- eventfd interrupts the reactor only when no idle workers exist

scheduler.hpp:
- Add condition_variable, reactor flags, idle thread count
- Add run_reactor(), wake_one_thread_and_unlock(), interrupt_reactor()
- Update class documentation to describe single reactor model

scheduler.cpp:
- Rewrite do_one() with single reactor loop logic
- Add run_reactor() for epoll_wait and I/O completion processing
- Add wake_one_thread_and_unlock() for smart wake coordination
- Fix errno corruption by saving it before timer processing
- Fix memory leak in post() using unique_ptr
- Fix over-counting bug in batched wake logic
- Fix work_finished() to wake all threads when work reaches 0

op.hpp:
- Remove unused 'events' field from epoll_op
- Remove unused get_epoll_op() function

sockets.hpp/sockets.cpp:
- Move implementations from header to new .cpp file
- Change vectors to unordered_map for O(1) destroy_impl()
- Remove redundant unregister_fd() calls in close_socket()

test/unit/io_context.cpp:
- Add testMultithreaded() for concurrent post and run
- Add testMultithreadedStress() for repeated iterations
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@sgerbino sgerbino merged commit d12a5fc into master Jan 21, 2026
26 of 27 checks passed
@cppalliance-bot
Copy link

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

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

2026-01-21 23:06:58 UTC

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.

5 participants