- tp1 = tcp_sk(sock->sk);
- /*
- * Quick test to see if there are connections on the queue.
- * This is cheaper than accept() itself because this saves us
- * the allocation of a new socket. (Which doesn't seem to be
- * used anyway)
- */
- if (tp1->accept_queue) {
- tux_proto_t *proto;
-
- if (!count++)
- __set_task_state(current, TASK_RUNNING);
-
- new_sock = sock_alloc();
- if (!new_sock)
- goto out;
-
- new_sock->type = sock->type;
- new_sock->ops = sock->ops;
-
- error = sock->ops->accept(sock, new_sock, O_NONBLOCK);
- if (error < 0)
- goto err;
- if (new_sock->sk->sk_state != TCP_ESTABLISHED)
- goto err;
-
- tp2 = tcp_sk(new_sock->sk);
- tp2->nonagle = 2;
- tp2->ack.pingpong = tux_ack_pingpong;
- new_sock->sk->sk_reuse = 1;
- sock_set_flag(new_sock->sk, SOCK_URGINLINE);
-
- /* Allocate a request-entry for the connection */
- req = kmalloc_req(ti);
- if (!req)
- BUG();
- link_tux_socket(req, new_sock);
-
- proto = req->proto = tux_listen->proto;
-
- proto->got_request(req);
- }
+ icsk1 = inet_csk(sock->sk);
+ /*
+ * Quick test to see if there are connections on the queue.
+ * This is cheaper than accept() itself because this saves us
+ * the allocation of a new socket. (Which doesn't seem to be
+ * used anyway)
+ */
+ if (!reqsk_queue_empty(&icsk1->icsk_accept_queue)) {
+ tux_proto_t *proto;
+
+ if (!count++)
+ __set_task_state(current, TASK_RUNNING);
+
+ new_sock = sock_alloc();
+ if (!new_sock)
+ goto out;
+
+ new_sock->type = sock->type;
+ new_sock->ops = sock->ops;
+
+ error = sock->ops->accept(sock, new_sock, O_NONBLOCK);
+ if (error < 0)
+ goto err;
+ if (new_sock->sk->sk_state != TCP_ESTABLISHED)
+ goto err;
+
+ tp2 = tcp_sk(new_sock->sk);
+ icsk2 = inet_csk(new_sock->sk);
+ tp2->nonagle = 2;
+ icsk2->icsk_ack.pingpong = tux_ack_pingpong;
+ new_sock->sk->sk_reuse = 1;
+ sock_set_flag(new_sock->sk, SOCK_URGINLINE);
+
+ /* Allocate a request-entry for the connection */
+ req = kmalloc_req(ti);
+ if (!req)
+ BUG();
+ link_tux_socket(req, new_sock);
+
+ proto = req->proto = tux_listen->proto;
+
+ proto->got_request(req);
+ }