Fix xnetsocket recvfrom never populating the from_addr due to fromlen being zero #1107
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.
What does this Pull Request accomplish?
Fix xnet socket grpc service
RecvFrom
implementation incorrectly passing 0 asfromlen
to the xnet socketrecvfrom
C API.Why should this Pull Request be merged?
When calling
recvfrom
grpc API, I noticed that thefrom_addr
is never filled in.recvfrom
is used by UDP sockets to receive a datagram packet, theRecvFrom
grpc service code is implemented like this:from_addr
is a structure thatlibrary_->RecvFrom
will fill in with the remote address that sent the datagram packet; thefromlen
parameter tells the API the size of thefrom_addr
structure.The currently generated grpc service code initializes
fromlen
as 0:nxsocklen_t fromlen {};
However, the
recvfrom
C implementation will only populatefrom_addr
iffromlen
is NOT 0:By passing 0,
from_addr
structure is never populated, leaving the grpc caller unable to retrieve information about the client address that sent the packet.What testing has been done?
Manually tested that by setting
fromlen
tosizeof(from_addr.storage)
the grpc call is now getting the client address.