diff options
author | Florian Westphal <fw@strlen.de> | 2010-08-17 07:00:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-17 20:31:51 -0400 |
commit | 3720d40b201fe82dce1d8a64a31bfbf49c221771 (patch) | |
tree | f20f2d614a0949b25a27004ecf9abe7c8dd6794d /net/tipc/socket.c | |
parent | f81380925209bc60732a57eef41ab440c056aacf (diff) |
tipc: add SO_RCVLOWAT support to stream socket receive path
Add support for the SO_RCVLOWAT socket option to TIPC's stream socket
type.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 66e889ba48fd..69d0fd1f3920 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1026,9 +1026,8 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock, | |||
1026 | struct sk_buff *buf; | 1026 | struct sk_buff *buf; |
1027 | struct tipc_msg *msg; | 1027 | struct tipc_msg *msg; |
1028 | unsigned int sz; | 1028 | unsigned int sz; |
1029 | int sz_to_copy; | 1029 | int sz_to_copy, target, needed; |
1030 | int sz_copied = 0; | 1030 | int sz_copied = 0; |
1031 | int needed; | ||
1032 | char __user *crs = m->msg_iov->iov_base; | 1031 | char __user *crs = m->msg_iov->iov_base; |
1033 | unsigned char *buf_crs; | 1032 | unsigned char *buf_crs; |
1034 | u32 err; | 1033 | u32 err; |
@@ -1050,6 +1049,8 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock, | |||
1050 | goto exit; | 1049 | goto exit; |
1051 | } | 1050 | } |
1052 | 1051 | ||
1052 | target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len); | ||
1053 | |||
1053 | restart: | 1054 | restart: |
1054 | 1055 | ||
1055 | /* Look for a message in receive queue; wait if necessary */ | 1056 | /* Look for a message in receive queue; wait if necessary */ |
@@ -1138,7 +1139,7 @@ restart: | |||
1138 | 1139 | ||
1139 | if ((sz_copied < buf_len) && /* didn't get all requested data */ | 1140 | if ((sz_copied < buf_len) && /* didn't get all requested data */ |
1140 | (!skb_queue_empty(&sk->sk_receive_queue) || | 1141 | (!skb_queue_empty(&sk->sk_receive_queue) || |
1141 | (flags & MSG_WAITALL)) && /* and more is ready or required */ | 1142 | (sz_copied < target)) && /* and more is ready or required */ |
1142 | (!(flags & MSG_PEEK)) && /* and aren't just peeking at data */ | 1143 | (!(flags & MSG_PEEK)) && /* and aren't just peeking at data */ |
1143 | (!err)) /* and haven't reached a FIN */ | 1144 | (!err)) /* and haven't reached a FIN */ |
1144 | goto restart; | 1145 | goto restart; |