]> git.proxmox.com Git - qemu.git/commit
net: EAGAIN handling for net/socket.c TCP
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Mon, 20 Aug 2012 09:14:35 +0000 (10:14 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Fri, 12 Oct 2012 02:44:18 +0000 (21:44 -0500)
commita638498f513e68aacd6306b56afd504383713665
tree63dede81e02122f8d6de7ea1e38e2435fb63f1ae
parent9d72a090b2f68201701b10b765c8b3eac596b3bc
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 <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 45a7f54a8bb3928ffa58d522e0d61acaee8277bb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
net/socket.c