-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[coap] resolve the issue where pending requests cannot be matched with their corresponding response messages with UDP port #10269
Conversation
their corresponding response messages In function FindRelatedRequest, parameter aMessageInfo represents the message received from the peer device. When iterating through pending requests, the outgoing message's destination address and port should match the source address and port of the received message instead of the destination address and port of the received message.
Size Report of OpenThread
|
aMetadata.mDestinationAddress.IsMulticast() || | ||
aMetadata.mDestinationAddress.GetIid().IsAnycastLocator()) && | ||
(aMetadata.mDestinationPort == aMessageInfo.GetPeerPort())) | ||
(aMetadata.mDestinationPort == aMessageInfo.GetSockPort())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the existing code is correct. It leverages MessageInfo
, which is applicable to both transmitting (tx) and receiving (rx) messages, dynamically adjusting the interpretation of "peer" and "local".
Within a MessageInfo
the peer address/port consistently refers to the other device involved in the communication (either the source we received the message from or the destination we are sending it to).
Specifically:
- For a received message,
GetPeerAddress()
will be the source address (sender's address). - For a sent message,
GetPeerAddress()
will be the destination address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZhangLe2016 I noticed you've changed the PR to only use GetSockPort()
. However, the earlier comment applies to GetPeerPort()
same was as GetPeerAddress()
. The existing code using the peer's port and address is the correct behavior.
Considering this, suggest closing this PR?
their corresponding response messages with UDP port In function FindRelatedRequest, parameter aMessageInfo represents the message received from the peer device. When iterating through pending requests, the outgoing message's destination port should match the destination port of the received message such as :MM 61631.
@abtink Thanks a lot for |
In function
FindRelatedRequest
, parameteraMessageInfo
represents the message received from the peer device. When iterating through pending requests, the outgoing message's destination address and port should match the source address and port of the received message instead of the destination address and port of the received message.