Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263518
b: refs/heads/master
c: 950e2d5
h: refs/heads/master
v: v3
  • Loading branch information
Peter Hurley authored and Gustavo F. Padovan committed Aug 11, 2011
1 parent bf1417d commit 915df84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 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: e5842cdb0f4f2c68f6acd39e286e5d10d8c073e8
refs/heads/master: 950e2d51e866623e4c360280aa63b85ab66d3403
28 changes: 14 additions & 14 deletions trunk/net/bluetooth/rfcomm/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,6 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f

lock_sock(sk);

if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
goto done;
}

if (sk->sk_type != SOCK_STREAM) {
err = -EINVAL;
goto done;
Expand All @@ -501,28 +496,33 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f

/* Wait for an incoming connection. (wake-one). */
add_wait_queue_exclusive(sk_sleep(sk), &wait);
while (!(nsk = bt_accept_dequeue(sk, newsock))) {
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if (!timeo) {
err = -EAGAIN;

if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
break;
}

release_sock(sk);
timeo = schedule_timeout(timeo);
lock_sock(sk);
nsk = bt_accept_dequeue(sk, newsock);
if (nsk)
break;

if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
if (!timeo) {
err = -EAGAIN;
break;
}

if (signal_pending(current)) {
err = sock_intr_errno(timeo);
break;
}

release_sock(sk);
timeo = schedule_timeout(timeo);
lock_sock(sk);
}
set_current_state(TASK_RUNNING);
__set_current_state(TASK_RUNNING);
remove_wait_queue(sk_sleep(sk), &wait);

if (err)
Expand Down

0 comments on commit 915df84

Please sign in to comment.