Skip to content

mw/com: Make ProxyBase::AreBindingsValid symmetrical with Skeleton side#414

Open
bemerybmw wants to merge 2 commits into
mainfrom
brem_fix_event_registration_impl
Open

mw/com: Make ProxyBase::AreBindingsValid symmetrical with Skeleton side#414
bemerybmw wants to merge 2 commits into
mainfrom
brem_fix_event_registration_impl

Conversation

@bemerybmw

Copy link
Copy Markdown
Contributor

Previously, ProxyBase::AreBindingsValid was implemented differently to avoid have to store a map of service elements (which also requires updating the map when moving a Proxy) in ProxyBase. However, we have since added these maps so there's no longer any reason to have the asymmetry in the implementations of AreBindingsValid.

@bemerybmw bemerybmw marked this pull request as ready for review May 13, 2026 08:21
@KrishaDeshkool

Copy link
Copy Markdown
Contributor

The removal of EventBindingRegistrationGuard would happen later?
other than the changes are fine as we discussed.

@bemerybmw

Copy link
Copy Markdown
Contributor Author

The removal of EventBindingRegistrationGuard would happen later? other than the changes are fine as we discussed.

Yep, that's happening in the next change that I'm working on.

@bemerybmw bemerybmw enabled auto-merge May 13, 2026 09:37
@bemerybmw bemerybmw force-pushed the brem_fix_event_registration_impl branch from fe22c01 to d496d88 Compare May 13, 2026 13:37
Instead, they only set once (see above) the `ProxyBase::are_service_element_bindings_valid_` member variable of their
parent during construction as this is currently the only feedback needed between proxy and its proxy events on binding
independent level.
Similarly to the skeleton side, the `impl::SkeletonBase` doesn't "know" its event/field/method children. Therefore,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

impl::SkeletonBase

impl::ProxyBase


#### Binding level Registration of proxy events/fields at their parent proxy

On the binding **specific** level things look different!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this sentence now make sense anymore? So there is no difference between binding-specific/binding-unspecific level anymore? In both cases the proxy knows its childs, because on both levels this registration process takes place ...


// Expecting that StartFindService is called and synchronously calls handler since provider exists
EXPECT_CALL(service_discovery_mock_, StartFindService(_, EnrichedInstanceIdentifier{identifier_}))
.WillOnce(WithArg<0>(Invoke([valid_find_service_handle, this](auto find_service_handler) noexcept {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpicky:

.WillOnce(InvokeArgument<0>([valid_find_service_handle, this](auto find_service_handler) noexcept {
is a lot clearer ;)

@bemerybmw bemerybmw Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think this works. I think this is intended to call the argument directly but we rather need to do some prep, call the callable and then return a value (via a lambda). From the docs, I think InvokeArgument was added before c++ had lambdas.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If this PR is still relevant, please leave a comment or push new changes to keep it open.

@github-actions github-actions Bot added the stale label May 28, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

This pull request has been automatically closed due to inactivity. Feel free to reopen it if you would like to continue working on it.

@github-actions github-actions Bot closed this Jun 4, 2026
auto-merge was automatically disabled June 4, 2026 07:52

Pull request was closed

@bemerybmw bemerybmw reopened this Jun 5, 2026
@github-actions github-actions Bot removed the stale label Jun 5, 2026
bemerybmw added 2 commits June 9, 2026 16:09
Previously, ProxyBase::AreBindingsValid was implemented differently to
avoid have to store a map of service elements (which also requires
updating the map when moving a Proxy) in ProxyBase. However, we have
since added these maps so there's no longer any reason to have the
asymmetry in the implementations of AreBindingsValid.
Previously, the event binding was registered from the binding
independent level via a function in the bindings interface. We change
this so that the registration is done completely on the binding level to
simplify the interface and also to allow each binding to decide whether
it needs to register events with the parent proxy. This is now inline
with how we handle registration for methods.

This also fixes an issue that the EventRegistrationGuard was accessing
the Proxy binding from the context of a ProxyEvent's destructor. When
move assigning a skeleton, the ProxyBase move assignment operator will
be called before that of the ProxyEvent, so the pointer to the Proxy
binding would be invalid when calling UnregisterEventBinding.
@bemerybmw bemerybmw force-pushed the brem_fix_event_registration_impl branch from d496d88 to 79ce5f1 Compare June 9, 2026 14:17
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.

3 participants