Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213829
b: refs/heads/master
c: 564e83b
h: refs/heads/master
i:
  213827: 73481ce
v: v3
  • Loading branch information
Allan Stephens authored and David S. Miller committed Aug 18, 2010
1 parent 154d37d commit 78c23ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2de58140a380172610b6a0f07f975abb2fbb311
refs/heads/master: 564e83b51a12b794e3f63a2d872398e1ee21616f
11 changes: 7 additions & 4 deletions trunk/net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct tipc_sock {
struct sock sk;
struct tipc_port *p;
struct tipc_portid peer_name;
long conn_timeout;
};

#define tipc_sk(sk) ((struct tipc_sock *)(sk))
Expand Down Expand Up @@ -240,9 +241,9 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
sock->state = state;

sock_init_data(sock, sk);
sk->sk_rcvtimeo = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT);
sk->sk_backlog_rcv = backlog_rcv;
tipc_sk(sk)->p = tp_ptr;
tipc_sk(sk)->conn_timeout = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT);

spin_unlock_bh(tp_ptr->lock);

Expand Down Expand Up @@ -1385,6 +1386,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
struct msghdr m = {NULL,};
struct sk_buff *buf;
struct tipc_msg *msg;
long timeout;
int res;

lock_sock(sk);
Expand Down Expand Up @@ -1445,11 +1447,12 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,

/* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */

timeout = tipc_sk(sk)->conn_timeout;
release_sock(sk);
res = wait_event_interruptible_timeout(*sk_sleep(sk),
(!skb_queue_empty(&sk->sk_receive_queue) ||
(sock->state != SS_CONNECTING)),
sk->sk_rcvtimeo);
timeout ? timeout : MAX_SCHEDULE_TIMEOUT);
lock_sock(sk);

if (res > 0) {
Expand Down Expand Up @@ -1712,7 +1715,7 @@ static int setsockopt(struct socket *sock,
res = tipc_set_portunreturnable(tport->ref, value);
break;
case TIPC_CONN_TIMEOUT:
sk->sk_rcvtimeo = msecs_to_jiffies(value);
tipc_sk(sk)->conn_timeout = msecs_to_jiffies(value);
/* no need to set "res", since already 0 at this point */
break;
default:
Expand Down Expand Up @@ -1767,7 +1770,7 @@ static int getsockopt(struct socket *sock,
res = tipc_portunreturnable(tport->ref, &value);
break;
case TIPC_CONN_TIMEOUT:
value = jiffies_to_msecs(sk->sk_rcvtimeo);
value = jiffies_to_msecs(tipc_sk(sk)->conn_timeout);
/* no need to set "res", since already 0 at this point */
break;
case TIPC_NODE_RECVQ_DEPTH:
Expand Down

0 comments on commit 78c23ab

Please sign in to comment.