You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/07/31 00:24:05 UTC

[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #1446: net/usrsock: Fix recv() couldn't peek data

masayuki2009 commented on a change in pull request #1446:
URL: https://github.com/apache/incubator-nuttx/pull/1446#discussion_r463341521



##########
File path: net/usrsock/usrsock_recvfrom.c
##########
@@ -424,6 +424,15 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
                */
 
               outaddrlen = state.valuelen_nontrunc;
+
+              /* If the MSG_PEEK flag is enabled, it will only peek
+               * from the buffer, so remark the input as ready.
+               */
+
+              if (flags & MSG_PEEK)
+                {
+                  conn->flags |= USRSOCK_EVENT_RECVFROM_AVAIL;

Review comment:
       > should we modify recvfrom_event to skip clear USRSOCK_EVENT_RECVFROM_AVAIL in the first place?
   
   @xiaoxiang781216 
   
   I'm confused that there are many 'flags' in the source code...
   
   In the recvfrom_event(), is it possible to access the flags (i.e. MSG flags) which was passed in usrsock_recvfrom()?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org