summaryrefslogtreecommitdiffstats
path: root/src/vnet/sctp/sctp.c
diff options
context:
space:
mode:
authorMarco Varlese <marco.varlese@suse.com>2018-02-13 12:38:52 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-02-15 07:31:01 +0000
commita38783e0d1ab1d4c661570a1ec90670a1fb0598d (patch)
tree0506e7820911191e9e80ceb0dd6172b3e7a888c8 /src/vnet/sctp/sctp.c
parent4941fcc23ab01f5ca918e56489d404b92d8bde90 (diff)
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 <marco.varlese@suse.com>
Diffstat (limited to 'src/vnet/sctp/sctp.c')
-rw-r--r--src/vnet/sctp/sctp.c13
1 files changed, 8 insertions, 5 deletions
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;
+ }
}
/**