Skip to content

Commit

Permalink
tipc: Don't reset the timeout when restarting
Browse files Browse the repository at this point in the history
As it may then take longer than what the user specified using
setsockopt(SO_RCVTIMEO).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed May 24, 2014
1 parent 6c705d1 commit 85d3fc9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,11 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
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;
DEFINE_WAIT(wait);
long timeo = *timeop;
int err;

for (;;) {
Expand All @@ -1013,6 +1014,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
break;
}
finish_wait(sk_sleep(sk), &wait);
*timeop = timeo;
return err;
}

Expand Down Expand Up @@ -1056,7 +1058,7 @@ static int tipc_recvmsg(struct kiocb *iocb, struct socket *sock,
restart:

/* 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)
goto exit;

Expand Down Expand Up @@ -1154,7 +1156,7 @@ static int tipc_recv_stream(struct kiocb *iocb, struct socket *sock,

restart:
/* 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)
goto exit;

Expand Down

0 comments on commit 85d3fc9

Please sign in to comment.