« Previous | Next » 

Revision 45a7f54a

ID45a7f54a8bb3928ffa58d522e0d61acaee8277bb

Added by Stefan Hajnoczi over 11 years ago

net: EAGAIN handling for net/socket.c TCP

Replace spinning send_all() with a proper non-blocking send. When the
socket write buffer limit is reached, we should stop trying to send and
wait for the socket to become writable again.

Non-blocking TCP sockets can return in two different ways when the write
buffer limit is reached:

1. ret = -1 and errno = EAGAIN/EWOULDBLOCK. No data has been written.

2. ret < total_size. Short write, only part of the message was
transmitted.

Handle both cases and keep track of how many bytes have been written in
s->send_index. (This includes the 'length' header before the actual
payload buffer.)

Signed-off-by: Stefan Hajnoczi <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences