Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266120
b: refs/heads/master
c: 1d83587
h: refs/heads/master
v: v3
  • Loading branch information
Ying Xue authored and Paul Gortmaker committed Sep 18, 2011
1 parent d4f5d2e commit 4bc4a59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 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: 9aa88c2a509e11e6efc466c88b386e0e01bef731
refs/heads/master: 1d835874af143a5c8273268d09e2f259b4c1ba89
26 changes: 14 additions & 12 deletions trunk/net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
struct tipc_port *tport = tipc_sk_port(sk);
struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
int needs_conn;
long timeout_val;
int res = -EINVAL;

if (unlikely(!dest))
Expand Down Expand Up @@ -564,6 +565,8 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
reject_rx_queue(sk);
}

timeout_val = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT);

do {
if (dest->addrtype == TIPC_ADDR_NAME) {
res = dest_name_check(dest, m);
Expand Down Expand Up @@ -600,16 +603,14 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
sock->state = SS_CONNECTING;
break;
}
if (m->msg_flags & MSG_DONTWAIT) {
res = -EWOULDBLOCK;
if (timeout_val <= 0L) {
res = timeout_val ? timeout_val : -EWOULDBLOCK;
break;
}
release_sock(sk);
res = wait_event_interruptible(*sk_sleep(sk),
!tport->congested);
timeout_val = wait_event_interruptible_timeout(*sk_sleep(sk),
!tport->congested, timeout_val);
lock_sock(sk);
if (res)
break;
} while (1);

exit:
Expand All @@ -636,6 +637,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
struct sock *sk = sock->sk;
struct tipc_port *tport = tipc_sk_port(sk);
struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
long timeout_val;
int res;

/* Handle implied connection establishment */
Expand All @@ -650,6 +652,8 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
if (iocb)
lock_sock(sk);

timeout_val = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT);

do {
if (unlikely(sock->state != SS_CONNECTED)) {
if (sock->state == SS_DISCONNECTING)
Expand All @@ -663,16 +667,14 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
total_len);
if (likely(res != -ELINKCONG))
break;
if (m->msg_flags & MSG_DONTWAIT) {
res = -EWOULDBLOCK;
if (timeout_val <= 0L) {
res = timeout_val ? timeout_val : -EWOULDBLOCK;
break;
}
release_sock(sk);
res = wait_event_interruptible(*sk_sleep(sk),
(!tport->congested || !tport->connected));
timeout_val = wait_event_interruptible_timeout(*sk_sleep(sk),
(!tport->congested || !tport->connected), timeout_val);
lock_sock(sk);
if (res)
break;
} while (1);

if (iocb)
Expand Down

0 comments on commit 4bc4a59

Please sign in to comment.