From a38783e0d1ab1d4c661570a1ec90670a1fb0598d Mon Sep 17 00:00:00 2001 From: Marco Varlese Date: Tue, 13 Feb 2018 12:38:52 +0100 Subject: SCTP: refactoring This patch takes care of some refactoring, including the initialization of the timestamp to calculate the RTO, the output state-machine validation which can be enabled (disabled by default) when debugging and some clean-up of unused fields. It also addresses the requirement of Karn's algorithm when computing the RTO. Change-Id: I6b875152369bff23cad085708cec1f7e1151cfa8 Signed-off-by: Marco Varlese --- src/vnet/sctp/sctp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/vnet/sctp/sctp.c') diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c index 61c0252b1ba..8fc5d9b55b2 100644 --- a/src/vnet/sctp/sctp.c +++ b/src/vnet/sctp/sctp.c @@ -470,10 +470,10 @@ void sctp_session_close (u32 conn_index, u32 thread_index) { ASSERT (thread_index == 0); - sctp_connection_t *sctp_conn; sctp_conn = sctp_connection_get (conn_index, thread_index); - sctp_connection_close (sctp_conn); + if (sctp_conn != NULL) + sctp_connection_close (sctp_conn); } void @@ -481,10 +481,13 @@ sctp_session_cleanup (u32 conn_index, u32 thread_index) { sctp_connection_t *sctp_conn; sctp_conn = sctp_connection_get (conn_index, thread_index); - sctp_connection_timers_reset (sctp_conn); - /* Wait for the session tx events to clear */ - sctp_conn->state = SCTP_STATE_CLOSED; + if (sctp_conn != NULL) + { + sctp_connection_timers_reset (sctp_conn); + /* Wait for the session tx events to clear */ + sctp_conn->state = SCTP_STATE_CLOSED; + } } /** -- cgit 1.2.3-korg