Skip to content

Conversation

ryanofsky
Copy link
Collaborator

Add CustomBuildMessage, CustomReadMessage, and CustomPassMessage hook functions. These functions can be defined to use custom code to convert C++ objects to and from Cap'n Proto messages. They work similarly to existing CustomBuildField, CustomReadField, and CustomPassField hooks, except they can be defined as normal functions not template functions, so they should be easier to use and require less verbosity in most cases, although they are less flexible.

The unit tests added here are new but the feature was originally implemented in bitcoin/bitcoin#10102 but and is being ported because it's a general purpose feature.

Add CustomBuildMessage, CustomReadMessage, and CustomPassMessage hook
functions. These functions can be defined to use custom code to convert C++
objects to and from Cap'n Proto messages. They work similarly to existing
CustomBuildField, CustomReadField, and CustomPassField hooks, except they can
be defined as normal functions not template functions, so they should be easier
to use and require less verbosity in most cases, although they are less
flexible.

The unit tests added here are new but the feature was originally implemented in
bitcoin/bitcoin#10102 but and is being ported because
it's a general purpose feature.
@ryanofsky ryanofsky merged commit a9e16da into bitcoin-core:master Jul 24, 2024
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 24, 2024
This update brings in the following change which allows simplifying the
multiprocess code in bitcoin:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 26, 2024
This update brings in the following change which allows simplifying the
multiprocess code in bitcoin:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Aug 8, 2024
This update brings in the following change which allows simplifying the
multiprocess code in bitcoin:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Aug 9, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Aug 13, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Aug 13, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 6, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 6, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 6, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 6, 2024
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 6, 2024
This update brings in the following change which allows simplifying the
multiprocess code in bitcoin:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 6, 2024
This update brings in the following change which allows simplifying the
multiprocess code in bitcoin:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 9, 2024
…nd cmake headers target

This update brings in the following changes:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
bitcoin-core/libmultiprocess#107 example: Remove manual client adding
bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking
bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly
bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 10, 2024
…nd cmake headers target

This update brings in the following changes:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
bitcoin-core/libmultiprocess#107 example: Remove manual client adding
bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking
bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly
bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 19, 2024
This update brings in the following change which allows simplifying the
multiprocess code in bitcoin:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Jan 12, 2025
…d ThreadContext bugfix

The CustomMessage functions allow simplifying custom IPC type code, and the
bugfix is needed to prevent in a crash in a new test which creates and destroys
connections in a loop. Upstream PRs are:

bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks
bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jul 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant