Browse Source

[NET]: Revert incorrect accept queue backlog changes.

This reverts two changes:

8488df894d05d6fa41c2bd298c335f944bb0e401
248f06726e866942b3d8ca8f411f9067713b7ff8

A backlog value of N really does mean allow "N + 1" connections
to queue to a listening socket.  This allows one to specify
"0" as the backlog and still get 1 connection.

Noticed by Gerrit Renker and Rick Jones.

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 18 years ago
parent
commit
64a146513f
2 changed files with 4 additions and 4 deletions
  1. 1 1
      include/net/sock.h
  2. 3 3
      net/unix/af_unix.c

+ 1 - 1
include/net/sock.h

@@ -426,7 +426,7 @@ static inline void sk_acceptq_added(struct sock *sk)
 
 
 static inline int sk_acceptq_is_full(struct sock *sk)
 static inline int sk_acceptq_is_full(struct sock *sk)
 {
 {
-	return sk->sk_ack_backlog >= sk->sk_max_ack_backlog;
+	return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
 }
 }
 
 
 /*
 /*

+ 3 - 3
net/unix/af_unix.c

@@ -934,7 +934,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
 
 
 	sched = !sock_flag(other, SOCK_DEAD) &&
 	sched = !sock_flag(other, SOCK_DEAD) &&
 		!(other->sk_shutdown & RCV_SHUTDOWN) &&
 		!(other->sk_shutdown & RCV_SHUTDOWN) &&
-		(skb_queue_len(&other->sk_receive_queue) >=
+		(skb_queue_len(&other->sk_receive_queue) >
 		 other->sk_max_ack_backlog);
 		 other->sk_max_ack_backlog);
 
 
 	unix_state_runlock(other);
 	unix_state_runlock(other);
@@ -1008,7 +1008,7 @@ restart:
 	if (other->sk_state != TCP_LISTEN)
 	if (other->sk_state != TCP_LISTEN)
 		goto out_unlock;
 		goto out_unlock;
 
 
-	if (skb_queue_len(&other->sk_receive_queue) >=
+	if (skb_queue_len(&other->sk_receive_queue) >
 	    other->sk_max_ack_backlog) {
 	    other->sk_max_ack_backlog) {
 		err = -EAGAIN;
 		err = -EAGAIN;
 		if (!timeo)
 		if (!timeo)
@@ -1381,7 +1381,7 @@ restart:
 	}
 	}
 
 
 	if (unix_peer(other) != sk &&
 	if (unix_peer(other) != sk &&
-	    (skb_queue_len(&other->sk_receive_queue) >=
+	    (skb_queue_len(&other->sk_receive_queue) >
 	     other->sk_max_ack_backlog)) {
 	     other->sk_max_ack_backlog)) {
 		if (!timeo) {
 		if (!timeo) {
 			err = -EAGAIN;
 			err = -EAGAIN;