Skip to content

Instantly share code, notes, and snippets.

@kkumar-fk
Last active July 23, 2019 04:14
Show Gist options
  • Save kkumar-fk/6abcb151771cd36770fb723925d49f57 to your computer and use it in GitHub Desktop.
Save kkumar-fk/6abcb151771cd36770fb723925d49f57 to your computer and use it in GitHub Desktop.
struct sock *inet_csk_accept(struct sock *sk)
{
struct sock *newsk = NULL; /* client socket */
/* Make sure that this socket is listening, and that it has something pending. */
lock_sock(sk);
if (sk->sk_state == TCP_LISTEN)
if ("there are completed connections waiting to be accepted")
newsk = get_first_connection(sk);
release_sock(sk);
return newsk;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment