Opened 6 months ago

Last modified 6 months ago

#18653 new bug

Unix Datagram and Stream Sockets do not support MSG_PEEK

Reported by: nielx Owned by: axeld
Priority: normal Milestone: Unscheduled
Component: Network & Internet/Stack Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

While running Rust's standard library test suite, I noticed that three tests that try to use 'peek' functionality seem to be in a deadlock. The commonality is that all three use the MSG_PEEK as a flag to recv. According to the POSIX specification, this flag is supposed to return the data (and the size of the data in the buffer), but leave it there so that it can be retrieved again in the future. It seems that our implementation does not do that due diligence, and therefore this invocation of recv is handled like a normal read.

The attached test program demonstrates this behaviour, as the test will block after the first peek, because the second attempt at recv is waiting for new data as the existing data is no longer there.

I decided to mark this issue as a bug rather than a request for enhancement, since the spec also states that EOPNOTSUPP is the error code if a flag is not supported by the protocol.

Attachments (1)

18653-test.cpp (3.9 KB ) - added by nielx 6 months ago.

Download all attachments as: .zip

Change History (3)

by nielx, 6 months ago

Attachment: 18653-test.cpp added

comment:2 by waddlesplash, 6 months ago

First part done in hrev57383.

Note: See TracTickets for help on using tickets.