mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
IPv4: Non-blocking IPv4 sockets should return -EAGAIN in recvfrom()
...if there are no packets in the receive queue.
This commit is contained in:
parent
43a6c70c2a
commit
ecd23ce1a1
1 changed files with 3 additions and 0 deletions
|
@ -222,6 +222,9 @@ ssize_t IPv4Socket::recvfrom(FileDescription& description, void* buffer, size_t
|
|||
ReceivedPacket packet;
|
||||
{
|
||||
LOCKER(lock());
|
||||
if (m_receive_queue.is_empty() && !description.is_blocking())
|
||||
return -EAGAIN;
|
||||
|
||||
if (!m_receive_queue.is_empty()) {
|
||||
packet = m_receive_queue.take_first();
|
||||
m_can_read = !m_receive_queue.is_empty();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue