From 7d6caa9926fcd9e5745f4d7143d78397a99b783d Mon Sep 17 00:00:00 2001 From: pwpmurthy Date: Fri, 19 May 2023 15:39:41 +0000 Subject: [PATCH] association_max_retrans to be taken from env variable Issue-ID: RIC-984 Change-Id: Icb83164c421f16ab2b7f029172d56c451d4d7116 Signed-off-by: pwpmurthy --- RIC-E2-TERMINATION/sctpThread.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/RIC-E2-TERMINATION/sctpThread.cpp b/RIC-E2-TERMINATION/sctpThread.cpp index 94da977..1ec624c 100644 --- a/RIC-E2-TERMINATION/sctpThread.cpp +++ b/RIC-E2-TERMINATION/sctpThread.cpp @@ -130,7 +130,6 @@ static void * monitor_loglevel_change_handler(void* arg) if( wfd < 0 ) { fprintf( stderr, "### ERR ### unable to add watch on config file %s: %s\n", fileName, strerror( errno ) ); } else { - FD_ZERO (&fds); FD_SET (ifd, &fds); while( 1 ) { @@ -984,6 +983,22 @@ void listener(sctp_params_t *params) { sctpevents.sctp_data_io_event = 1; setsockopt(peerInfo->fileDescriptor, SOL_SCTP, SCTP_EVENTS,(const void *)&sctpevents, sizeof(sctpevents) ); + { + char *value = getenv("SCTP_ASSOC_MAX_RETRANS"); + if (value) + { + int int_val = atoi(value); + mdclog_write(MDCLOG_INFO, "Changing sctp_association_max_retrans to %s, %d\n", value, int_val); + if (int_val > 0) + { + struct sctp_assocparams sctpassocparams; + memset((void *)&sctpassocparams, 0, sizeof(sctpassocparams)); + sctpassocparams.sasoc_asocmaxrxt = int_val; + setsockopt(peerInfo->fileDescriptor, SOL_SCTP, SCTP_ASSOCINFO, (const void *)&sctpassocparams, sizeof(sctpassocparams)); + } + } + } + auto ans = getnameinfo(&in_addr, in_len, peerInfo->hostName, NI_MAXHOST, peerInfo->portNumber, NI_MAXSERV, (unsigned )((unsigned int)NI_NUMERICHOST | (unsigned int)NI_NUMERICSERV)); -- 2.16.6