From: Allan Stephens Date: Tue, 15 Apr 2008 07:07:15 +0000 (-0700) Subject: [TIPC]: Allow stream receive to read from multiple TIPC messages X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=a198d3a200313bca8261e30e6daaad790937fd7e;p=openwrt%2Fstaging%2Fblogic.git [TIPC]: Allow stream receive to read from multiple TIPC messages This patch allows a stream socket to receive data from multiple TIPC messages in its receive queue, without requiring the use of the MSG_WAITALL flag. Acknowledgements to Florian Westphal for identifying this issue and suggesting how to correct it. Signed-off-by: Allan Stephens Signed-off-by: David S. Miller --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 91aa2dc51771..c1a199c0fa6d 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1065,7 +1065,9 @@ restart: /* Loop around if more data is required */ if ((sz_copied < buf_len) /* didn't get all requested data */ - && (flags & MSG_WAITALL) /* ... and need to wait for more */ + && (!skb_queue_empty(&sock->sk->sk_receive_queue) || + (flags & MSG_WAITALL)) + /* ... and more is ready or required */ && (!(flags & MSG_PEEK)) /* ... and aren't just peeking at data */ && (!err) /* ... and haven't reached a FIN */ )