Commit 85d3fc94 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

tipc: Don't reset the timeout when restarting

As it may then take longer than what the user specified using
setsockopt(SO_RCVTIMEO).
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c705d13
...@@ -985,10 +985,11 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, ...@@ -985,10 +985,11 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
return 0; return 0;
} }
static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo) static int tipc_wait_for_rcvmsg(struct socket *sock, long *timeop)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
long timeo = *timeop;
int err; int err;
for (;;) { for (;;) {
...@@ -1013,6 +1014,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo) ...@@ -1013,6 +1014,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
break; break;
} }
finish_wait(sk_sleep(sk), &wait); finish_wait(sk_sleep(sk), &wait);
*timeop = timeo;
return err; return err;
} }
...@@ -1056,7 +1058,7 @@ static int tipc_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1056,7 +1058,7 @@ static int tipc_recvmsg(struct kiocb *iocb, struct socket *sock,
restart: restart:
/* Look for a message in receive queue; wait if necessary */ /* Look for a message in receive queue; wait if necessary */
res = tipc_wait_for_rcvmsg(sock, timeo); res = tipc_wait_for_rcvmsg(sock, &timeo);
if (res) if (res)
goto exit; goto exit;
...@@ -1154,7 +1156,7 @@ static int tipc_recv_stream(struct kiocb *iocb, struct socket *sock, ...@@ -1154,7 +1156,7 @@ static int tipc_recv_stream(struct kiocb *iocb, struct socket *sock,
restart: restart:
/* Look for a message in receive queue; wait if necessary */ /* Look for a message in receive queue; wait if necessary */
res = tipc_wait_for_rcvmsg(sock, timeo); res = tipc_wait_for_rcvmsg(sock, &timeo);
if (res) if (res)
goto exit; goto exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment