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

Fix cordep eventcbs #12996

Closed

Conversation

haukepetersen
Copy link
Contributor

Contribution description

fixes #12884

Testing procedure

a) connect to a RD, watch for the "RD endpoint event: successfully updated client registration" messages, kill the RD, wait for the "RD endpoint event: dropped client registration" message -> it should only appear once
b) @MatthiasBraeuer could you verify that reconnecting from the event callback does not lead to deadlocks anymore? Thanks

Issues/PRs references

fixes #12884

This changes allows to call any cord_ep API function from with the
event callbacks provided by the standalone module.
@haukepetersen haukepetersen added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: CoAP Area: Constrained Application Protocol implementations labels Dec 20, 2019
@MatthiasBraeuer
Copy link

Sure I can verify that. I will do that at the beginning of January!

Copy link

@MatthiasBraeuer MatthiasBraeuer left a comment

Choose a reason for hiding this comment

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

One other thought I have is, that the cord_ep_standalone_signal() function can only be called with a bool. Therefore you do not know which command actually led to the current situation (registered, deregistered). This circumstance makes it hard in the callback to know if the deregistered state is the wanted state (after a remove from the resource directory), or if the actual command failed (was trying to update).

I do not know what the wanted behavior would be, but I think there should be some clarification/documentation what is supposed to be triggered when and with what information (only in code, also after executing a shell command, ...). When these questions are clarified, it can be changed to a consistent and documented version.

The current version seems to work, but contains some inconsistencies and depending on how it is used, does not give you all the information you might need and could receive.

_rd_loc[0] = '\0';
}
mutex_unlock(&_mutex);

#ifdef MODULE_CORD_EP_STANDALONE
if (res != CORD_EP_OK) {

Choose a reason for hiding this comment

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

To only signal the standalone module when updating has been failed seems rather unwanted behavior, since you would have to handle the success case yourself. Furthermore triggering an update from the shell does not trigger the callback, which seems inconsistent.

Maybe you could signal the success case too in here and remove triggering the callback on success in the standalone module (see https://github.com/RIOT-OS/RIOT/pull/12996/files#diff-aa4a4d29f6ba7d1ecd4374a7eb15d331R77).

@@ -76,9 +76,6 @@ static void *_reg_runner(void *arg)
_set_timer();
_notify(CORD_EP_UPDATED);

Choose a reason for hiding this comment

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

Remove _notify, since it should be triggered in ep_cord.c

@haukepetersen
Copy link
Contributor Author

Yepp, you have a point! I don't know why I haven't seen this earlier, but right now a proper solution seems obvious to me: we simply add a proper event callback to the base cord_ep module allowing for more detailed feedback on the modules state. The ep_standalone can then simply use that callback and forward the events to the high-level user.

Will look into this as soon as I find a minute or two...

@haukepetersen haukepetersen removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 15, 2020
@haukepetersen
Copy link
Contributor Author

Done: I decided to open a new PR for the proposed changes: #13128

@miri64
Copy link
Member

miri64 commented Jun 25, 2020

Done: I decided to open a new PR for the proposed changes: #13128

So can this one be closed?

@haukepetersen
Copy link
Contributor Author

I would like to get some feedback on #13128 first. In case that new PR is bullshit, we still have this one :-)

@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 22, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@Teufelchen1
Copy link
Contributor

What's the status here and with #13128?

Given the new approach by @bergzand in #20040 I would opt to close both PRs as @haukepetersen does not seem to be active anymore?

@Teufelchen1
Copy link
Contributor

Miri and koen agreed to close those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

examples/cord_ep: Dead lock when (re-)registering in callback function
5 participants