From a68adc220603baffc355ecea8865b3ea9707ab00 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 29 Feb 2012 19:14:23 +0100 Subject: slirp: Cleanup resources on instance removal Close & free sockets when shutting down a slirp instance, also release all buffers. CC: Michael S. Tsirkin Signed-off-by: Jan Kiszka --- slirp/tcp_subr.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'slirp/tcp_subr.c') diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 143a238..6f6585a 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -55,6 +55,13 @@ tcp_init(Slirp *slirp) slirp->tcp_last_so = &slirp->tcb; } +void tcp_cleanup(Slirp *slirp) +{ + while (slirp->tcb.so_next != &slirp->tcb) { + tcp_close(sototcpcb(slirp->tcb.so_next)); + } +} + /* * Create template to be used to send tcp packets on a connection. * Call after host entry created, fills -- cgit v1.1