examples/cord_epsim: change default RD server addr handling#10464
examples/cord_epsim: change default RD server addr handling#10464miri64 merged 5 commits intoRIOT-OS:masterfrom
Conversation
There was a problem hiding this comment.
Overall, these changes accomplish the goal, and it's definitely better than failing on the multicast address. I tested, and the success case still works. I also tested changing RD_LT. See the few minor suggestions in the code. Barely worth blocking, but easy fixes.
81f789f to
e7c6fbf
Compare
|
Alright, here is a more radical rework of this PR:
Overall, this leads to a slimmer and more efficient implementation and hopefully makes |
|
I like the simpler rework! I removed the testing label because I'm retesting now. I plan to post a review in the next day or so. |
|
good to hear, thanks! |
|
[edited for clearer explanation of error] I like the simple main loop rather than a separate thread. Overall this version uses around 15K less flash and 600 bytes less RAM on a samr21-xpro. I agree it was a little odd to include ipv6_addr_from_str() internally. It's also nice not to have the separate CORD_SERVER_ definitions. I tested this quite a bit, and I'm worried that the cord_epsim module is a little too simple. For example, suppose the app is built with default setttings and the RD server is unreachable. In this case, cord_epsim returns an error code some of the time. The error occurs when gcoap tries to send a registration confirmably before the previous confirmable send has timed out. By default, gcoap supports a single open confirmable message (GCOAP_RESEND_BUFS_MAX). On average a CoAP confirmable message will timeout after 77s, but cord_epsim resends after 45s. If the user sets a longer, more realistic timeout, they will not see any error feedback in a terminal. I propose adding a response handler to cord_epsim to maintain a state variable. The response handler maintains the variable simply based on reception of an ACK from the server. Then the main module can query it as desired. Something like this for cord_epsim: |
|
Thats a very good point and I fully agree. Will include those proposed changes. |
|
addressed comments and added the internal state tracking. This should indeed be far more failure tolerant now. |
| _state = (req_state == GCOAP_MEMO_RESP) ? CORD_EPSIM_OK : CORD_EPSIM_ERROR; | ||
| } | ||
|
|
||
| int cord_epsim_register(const sock_udp_ep_t *rd_ep) |
There was a problem hiding this comment.
Presently this function just returns a state value. However, before returning it must first set the _state variable.
df19382 to
c19df21
Compare
|
Fixed setting |
|
ACK! Tests fine. Please squash. |
c19df21 to
87f584a
Compare
|
done |
|
@haukepetersen, please review the Murdock failure. It looks spurious to me. Should we just trigger a rebuild? How to do that? |
87f584a to
96d6339
Compare
|
I rebased. lets see what Murdock says now. |
examples/cord_epsim/Makefile
Outdated
| # user. | ||
| ifeq (\"::1\", $(RD_ADDR)) | ||
| ifneq (clean, $(MAKECMDGOALS)) | ||
| $(info WARNING: the RD server address is set to the loopback device!) |
There was a problem hiding this comment.
Looks to me like it is this line that is causing problems on Murdock with its weird way to parse output, since RD_ADDR is set to ::1 above.
96d6339 to
01a58da
Compare
|
I took the warning part on the localhost address out of the Makefile. Thinking about this, I think it should be sufficient to have the warning in the readme file. Also the RD address is printed when the application starts, so that users at least have a good chance in seeing the |
|
@kb2ma would you mind to have one final look if my latest changes are ok with you? Thanks! |
|
Looks good to me. Tests still pass. The user will see the address in the CLI. Thanks to @miri64 for finding the problem. Please squash. Let's try this again. |
This commit rewrites the example so that the registration loop is run inside the main() function instead of running the standalone submodule of epsim. It also adapts the example application to parse the RD UDP endpoint locally and provide this to epsim's register() function.
0ca842f to
840c8ae
Compare
|
squashed. lets hope for the best :-) |
Contribution description
The
cord_epsimexample was per default using the all-nodes multicast address for contacting the RD server. Now the problem is, that currently our coap implementations (gcoap+nanocoap) do not support any multicast addressing (group communication). So the default configuration does actually not make much sense.This PR changes the default RD address definition to the loopback address, so it will compile correctly in our compile tests. At the same time, it will print a warning and tell the user to specify a valid address using the
RD_ADDRvariable.The doc and Makefile are adapted accordingly. Also I removed the default
CORD_SERVER_ADDRdefine from thecord/config.hfile and put a check for the define in thecord_epsim.csource.Testing procedure
Run a RD server (e.g.
aiocoap-rd), get its address, and compile and run thecord_epsimexample withRD_ADDRset to that address.Issues/PRs references
This issue was pointed out in #9857 initially.