Re: recvmsg() "short receive" after FIONREAD
- In reply to: Andriy Gapon : "recvmsg() "short receive" after FIONREAD"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Sep 2021 19:20:42 UTC
On Fri, Sep 10, 2021 at 09:51:38PM +0300, Andriy Gapon wrote: > > > I observe a problem with the code that can be seen here: > https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/modules/rtp/sap.c#L142 > > The code uses ioctl(FIONREAD) to check the size of available data in a socket. > Does / should this work? Yes, FIONREAD returns the number of available bytes in the socket receive buffer. > Then the code calls recvmsg() on the socket with single vector with iov_len > equal to the size obtained earlier. > > But the return value from recvmsg() is smaller than the iov_len value. > In my test I see 215 vs expected 263 (so, the difference is 48). What type of socket is it? Is it possible that there are control messages in the receive buffer? They would be dropped here since the code does not specify a buffer for them, but they are counted in the return value of FIONREAD. > Does this ring a bell to anyone? > I see this on a month old 14.0-CURRENT arm64. It doesn't sound familiar to me at least.