aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 7b81fdd4f6d6..f7ac94de24fe 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -64,6 +64,7 @@ struct tipc_sock {
64 struct sock sk; 64 struct sock sk;
65 struct tipc_port *p; 65 struct tipc_port *p;
66 struct tipc_portid peer_name; 66 struct tipc_portid peer_name;
67 long conn_timeout;
67}; 68};
68 69
69#define tipc_sk(sk) ((struct tipc_sock *)(sk)) 70#define tipc_sk(sk) ((struct tipc_sock *)(sk))
@@ -240,9 +241,9 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
240 sock->state = state; 241 sock->state = state;
241 242
242 sock_init_data(sock, sk); 243 sock_init_data(sock, sk);
243 sk->sk_rcvtimeo = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT);
244 sk->sk_backlog_rcv = backlog_rcv; 244 sk->sk_backlog_rcv = backlog_rcv;
245 tipc_sk(sk)->p = tp_ptr; 245 tipc_sk(sk)->p = tp_ptr;
246 tipc_sk(sk)->conn_timeout = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT);
246 247
247 spin_unlock_bh(tp_ptr->lock); 248 spin_unlock_bh(tp_ptr->lock);
248 249
@@ -1385,6 +1386,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1385 struct msghdr m = {NULL,}; 1386 struct msghdr m = {NULL,};
1386 struct sk_buff *buf; 1387 struct sk_buff *buf;
1387 struct tipc_msg *msg; 1388 struct tipc_msg *msg;
1389 long timeout;
1388 int res; 1390 int res;
1389 1391
1390 lock_sock(sk); 1392 lock_sock(sk);
@@ -1445,11 +1447,12 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1445 1447
1446 /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */ 1448 /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */
1447 1449
1450 timeout = tipc_sk(sk)->conn_timeout;
1448 release_sock(sk); 1451 release_sock(sk);
1449 res = wait_event_interruptible_timeout(*sk_sleep(sk), 1452 res = wait_event_interruptible_timeout(*sk_sleep(sk),
1450 (!skb_queue_empty(&sk->sk_receive_queue) || 1453 (!skb_queue_empty(&sk->sk_receive_queue) ||
1451 (sock->state != SS_CONNECTING)), 1454 (sock->state != SS_CONNECTING)),
1452 sk->sk_rcvtimeo); 1455 timeout ? timeout : MAX_SCHEDULE_TIMEOUT);
1453 lock_sock(sk); 1456 lock_sock(sk);
1454 1457
1455 if (res > 0) { 1458 if (res > 0) {
@@ -1712,7 +1715,7 @@ static int setsockopt(struct socket *sock,
1712 res = tipc_set_portunreturnable(tport->ref, value); 1715 res = tipc_set_portunreturnable(tport->ref, value);
1713 break; 1716 break;
1714 case TIPC_CONN_TIMEOUT: 1717 case TIPC_CONN_TIMEOUT:
1715 sk->sk_rcvtimeo = msecs_to_jiffies(value); 1718 tipc_sk(sk)->conn_timeout = msecs_to_jiffies(value);
1716 /* no need to set "res", since already 0 at this point */ 1719 /* no need to set "res", since already 0 at this point */
1717 break; 1720 break;
1718 default: 1721 default:
@@ -1767,7 +1770,7 @@ static int getsockopt(struct socket *sock,
1767 res = tipc_portunreturnable(tport->ref, &value); 1770 res = tipc_portunreturnable(tport->ref, &value);
1768 break; 1771 break;
1769 case TIPC_CONN_TIMEOUT: 1772 case TIPC_CONN_TIMEOUT:
1770 value = jiffies_to_msecs(sk->sk_rcvtimeo); 1773 value = jiffies_to_msecs(tipc_sk(sk)->conn_timeout);
1771 /* no need to set "res", since already 0 at this point */ 1774 /* no need to set "res", since already 0 at this point */
1772 break; 1775 break;
1773 case TIPC_NODE_RECVQ_DEPTH: 1776 case TIPC_NODE_RECVQ_DEPTH: