Skip to content

Conversation

@paolopas
Copy link

@paolopas paolopas commented Dec 12, 2025

This PR continues the factorization of the #550.

Note

This is the second child, the code is branched from #553 (first child), so this one accumulate the changes.

Each commit has been checked for regressions.

  • 37e31ba clean up
  • 40ed673 get_dispatch_wrapper finally replaced with the new make_handler,
    I tried to keep the changes to the bare minimum.
    • The new handler is faster; previously, a callback required two boost::bind (one of which was copied when passing parameters) plus one lambda. Now, all you need is a wrapper around a member pointer (std::mem_fn, which is then forwarded and not copied), a std::bind, and a lambda.
    • Smart pointers guarding against any potential dangling pointers are managed more simply and consistently, freeing target callback methods from the responsibility of dealing with them.
    • All callbacks now have the same signature, and the methods that generate them could even be replaced by a macro.
    • The last but not the least everything is now easier to understand (that is, develop and maintain); readability counts
    • std::function is derived from the analogous boost (same for std::bind), to avoid mixing std and boost I have replaced the boost::bind and boost::function with the equivalents from the standard library. This also helps with Support of ASIO standalone edition #381
  • 5090d0f Added a bottom note about a race condition involving _read_pendingand _write_pending flags. This issue will be automatically fixed along with Boost handler doesn't work with SSL #424 (already tested), the note serves as a warning.

At this point the handler is just more robust and cleaner than before, from the next PRs I will start adding features and bug fixes.

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.

1 participant