apps/examples/usrsocktest: Add MSG_PEEK flag support

Do not decrement the recv_avail_bytes if MSG_PEEK flag is specified.
This commit is contained in:
SPRESENSE 2020-08-06 10:50:56 +09:00 committed by Masayuki Ishikawa
parent 63a5ddcc7c
commit 4bd506b7f5

View file

@ -879,7 +879,12 @@ prepare:
{
char tmp = 'a' + i;
tsock->recv_avail_bytes--;
/* Check if MSG_PEEK flag is specified. */
if ((req->flags & MSG_PEEK) != MSG_PEEK)
{
tsock->recv_avail_bytes--;
}
wlen = write(fd, &tmp, 1);
if (wlen < 0)