net/gcoap: Track remote endpoint for all requests#8250
Merged
smlng merged 1 commit intoRIOT-OS:masterfrom Dec 18, 2017
Merged
Conversation
smlng
suggested changes
Dec 14, 2017
Member
smlng
left a comment
There was a problem hiding this comment.
looks good to me, still a suggestion:
| * return Result of memcmp (-1, 0, 1) if address family and port match; | ||
| * otherwise -2. | ||
| */ | ||
| static int _cmp_endpoints(const sock_udp_ep_t *ep1, const sock_udp_ep_t *ep2) |
Member
There was a problem hiding this comment.
from its usage, IMHO a static bool _endpoints_equal(ep1, ep2) function would be more appropriate, which returns only true or false.
For example (untested):
static bool _endpoints_equal(const sock_udp_ep_t *ep1, const sock_udp_ep_t *ep2)
{
if (ep1->family != ep2->family) {
return false;
}
if (ep1->port != ep2->port) {
return false;
}
if ((ep1->family == AF_INET) && (ep1->addr.ipv4_u32 != ep2->addr.ipv4_u32)) {
return false;
}
else if (memcmp(&ep1->addr.ipv6[0], &ep2->addr.ipv6[0], 16) != 0) {
return false;
}
return true;
} Only a suggestion, what do you think? Otherwise I trust that the changes fit your grander scheme 😉
Member
Author
There was a problem hiding this comment.
Thanks, @smlng! I agree that your function fits the purpose better. Working on fixup commit.
smlng
approved these changes
Dec 18, 2017
Member
|
please squash, I'll test |
692bd83 to
062bc15
Compare
Member
Author
|
Squashed. |
Member
|
ACK, tested on macOS and PhyNode, works! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Used to improve request/response matching.