mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-04 08:17:46 +00:00
tcp: check local var (timeo) before socket fields in one test
Testing timeo before sk_err/sk_state/sk_shutdown makes more sense. Modern applications use non-blocking IO, while a socket is terminated only once during its life time. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f35f821935
commit
8bd172b787
1 changed files with 2 additions and 2 deletions
|
@ -2399,10 +2399,10 @@ static int tcp_recvmsg_locked(struct sock *sk, struct msghdr *msg, size_t len,
|
|||
break;
|
||||
|
||||
if (copied) {
|
||||
if (sk->sk_err ||
|
||||
if (!timeo ||
|
||||
sk->sk_err ||
|
||||
sk->sk_state == TCP_CLOSE ||
|
||||
(sk->sk_shutdown & RCV_SHUTDOWN) ||
|
||||
!timeo ||
|
||||
signal_pending(current))
|
||||
break;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue