From a400d04306bce1d90fa1fb76eb5ed9c3977a1c32 Mon Sep 17 00:00:00 2001 From: rrs Date: Mon, 2 Jul 2007 19:22:22 +0000 Subject: - Consolidate the code that free's chunks to actually also call the sctp_free_remote_address() function. - Assure that when we allocate a chunk the whoTo is NULL, also when we free it and place it into the cache we NULL it (that way the consolidation code will always work). - Fix a small race, when a empty data holder is left on the stream out queue, and both sides do a shutdown, the empty data holder would prevent us from sending a SHUTDOWN-ACK and at the same time we never would cleanup the empty holder (since nothing was ever in queue). We now add a utility function that a) cleans up empty holders and b) properly determines if there are still pending data chunks on the stream out wheel. Approved by: re@freebsd.org (Ken Smith) --- sys/netinet/sctp_var.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/netinet/sctp_var.h') diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h index 74e514b..f05a368 100644 --- a/sys/netinet/sctp_var.h +++ b/sys/netinet/sctp_var.h @@ -90,6 +90,10 @@ extern struct pr_usrreqs sctp_usrreqs; #define sctp_free_a_chunk(_stcb, _chk) { \ + if ((_chk)->whoTo) { \ + sctp_free_remote_addr((_chk)->whoTo); \ + (_chk)->whoTo = NULL; \ + } \ if (((_stcb)->asoc.free_chunk_cnt > sctp_asoc_free_resc_limit) || \ (sctppcbinfo.ipi_free_chunks > sctp_system_free_resc_limit)) { \ SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, (_chk)); \ @@ -106,6 +110,7 @@ extern struct pr_usrreqs sctp_usrreqs; (_chk) = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk, struct sctp_tmit_chunk); \ if ((_chk)) { \ SCTP_INCR_CHK_COUNT(); \ + (_chk)->whoTo = NULL; \ } \ } else { \ (_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \ -- cgit v1.1