How to destroy a socket?

Matthias Welwarsky (dg2fef@afthd.tu-darmstadt.de)
Fri, 22 May 1998 21:43:56 +0200


Hi,

I need to know how to destroy a socket TheRightWay(tm). For now I do the
following:

sk->state = TCP_CLOSE;
sk->err = <err>;
sk->shutdown |= SEND_SHUTDOWN;
if (!sk->dead)
sk->state_change(sk);
sk->dead = 1;
sk->destroy = 1;

while ((skb = skb_dequeue(&sk->receive_queue)) != NULL)
kfree_skb(skb, FREE_READ);
sk_free(sk);

Is there anything more to be done? Especially if there's still
rmem/wmem_alloced on the socket?

Gruss,
Matthias

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu