Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 0399657c authored by Erwin Jansen's avatar Erwin Jansen Committed by Myles Watson
Browse files

Read all data from socket, vs. a subset

Sockets are not guaranteed to provide all the data that is requested in
a recv. From the documentation:

If no messages are available at the socket, the receive calls wait for
a message to arrive, unless the socket is nonblocking (see fcntl(2)), in
which case the value -1 is returned and errno is set to EAGAIN or
EWOULDBLOCK. The receive calls normally return any data available, up to
the requested amount, rather than waiting for receipt of the full amount
requested.

We now add a function that retrieves all requested data from a read,
looping until the whole requested buffer can be filled.

The sockets are blocking and configured with a timeout, so the receive
can still exit if needed.

Bug: 194106305
Test: gd/cert/run
Change-Id: I26f8025bc377a8d323df0ba81329730dc4a9c6f6
parent 3dcb33a8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment