Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bond Formed semantics #101

Open
TSNoble opened this issue Nov 17, 2024 · 0 comments
Open

Bond Formed semantics #101

TSNoble opened this issue Nov 17, 2024 · 0 comments

Comments

@TSNoble
Copy link

TSNoble commented Nov 17, 2024

I've been trying to use bond as an alternative to a custom heartbeat solution we've been using in our ROS stack, and I'm having trouble getting the onFormedCallback to trigger consistently. I'm unsure if this is unintended behaviour, or if I'm misunderstanding the intent of the Formed state.

My (possibly incorrect) understanding is that a Bond enters the Formed state when both sides of the connection have been created and started e.g, my expected behaviour (it's kind of pseudo-codey and for simplicity each line is ordered by time).

<node-1> bond::Bond bond(<params>)
<node-1> bond.setOnFormed([](){ std::cout << "Hello 1" << std::endl; });
<node-1> bond.start()
<node-2> bond::Bond bond(<params>)
<node-2> bond.setOnFormed([](){ std::cout << "Hello 2 << std::endl; });
<node-2> bond.start();
<node-1> prints "Hello 1" (ordering here not necessarily important)
<node-2> prints "Hello 2" (ordering here not necessarily important)

The actual behaviour is that sometimes the callbacks trigger and sometimes they don't, and I'm a little confused as to when a bond enters the Formed state:

<node-1> bond::Bond bond(<params>)
<node-1> bond.setOnFormed([](){ std::cout << "Hello 1" << std::endl; });
<node-1> bond.start()
# Is `Formed` tied to instantiation of the bond, or starting of the bond?
# Additionally, could this bond already be in the `Formed` state, since its sister is already set up?
# i.e. `setOnFormed` is already to late to trigger
<node-2> bond::Bond bond(<params>)
<node-2> bond.setOnFormed([](){ std::cout << "Hello 2 << std::endl; });
# If tied to starting, are both bonds `Formed` after both ends are started
# or is each bond formed only when its sister is started? 
# i.e. timing of starts is important
<node-2> bond.start();
<node-1> prints "Hello 1" (ordering here not necessarily important)
<node-2> prints "Hello 2" (ordering here not necessarily important)

I'm wondering if the actual behaviour is that only one side of the bond needs to start for the other side to register as formed? If my original assumption is correct, I can provide a more detailed example.

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

No branches or pull requests

1 participant