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

gcoap: accept resources in any order #18651

Merged
merged 2 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions sys/include/net/gcoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,7 @@ typedef struct {
* @brief A modular collection of resources for a server
*/
struct gcoap_listener {
const coap_resource_t *resources; /**< First element in the array of
* resources; must order alphabetically */
const coap_resource_t *resources; /**< First element in the array of resources */
size_t resources_len; /**< Length of array */
/**
* @brief Transport type for the listener
Expand Down
6 changes: 1 addition & 5 deletions sys/net/application_layer/gcoap/gcoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,9 @@ static int _request_matcher_default(gcoap_listener_t *listener,
int res = coap_match_path(*resource, uri);

/* URI mismatch */
if (res > 0) {
if (res != 0) {
continue;
}
/* resources expected in alphabetical order */
else if (res < 0) {
break;
}

/* potential match, check for method */
if (! ((*resource)->methods & method_flag)) {
Expand Down