]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[TIPC]: Allow stream receive to read from multiple TIPC messages
authorAllan Stephens <allan.stephens@windriver.com>
Tue, 15 Apr 2008 07:07:15 +0000 (00:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Apr 2008 07:07:15 +0000 (00:07 -0700)
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 <fw-tipc@strlen.de> for
identifying this issue and suggesting how to correct it.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/socket.c

index 91aa2dc51771988c891c92a5859c68d495abb9ff..c1a199c0fa6d838119bf1cca89df479e75d692eb 100644 (file)
@@ -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 */
            )