Add gcov support and signal to version 3.0.6 26/2126/1 PI3
authoraa7133@att.com <aa7133@att.com>
Mon, 30 Dec 2019 13:04:29 +0000 (15:04 +0200)
committeraa7133@att.com <aa7133@att.com>
Mon, 30 Dec 2019 13:04:53 +0000 (15:04 +0200)
Change-Id: I46f60169c9b75428e079f86e5ac7a588c76083ab
Signed-off-by: aa7133@att.com <aa7133@att.com>
RIC-E2-TERMINATION/container-tag.yaml
RIC-E2-TERMINATION/sctpThread.cpp
RIC-E2-TERMINATION/sctpThread.h

index aa4aed2..959e064 100644 (file)
@@ -1,3 +1,3 @@
 # The Jenkins job requires a tag to build the Docker image.
 # Global-JJB script assumes this file is in the repo root.
-tag: 3.0.5
+tag: 3.0.6
index d5d72a7..e46648b 100644 (file)
@@ -30,6 +30,15 @@ using namespace opentracing;
 //{
 //#endif
 
+// need to expose without the include of gcov
+extern "C" void __gcov_flush(void);
+
+static void catch_function(int signal) {
+    __gcov_flush();
+    exit(signal);
+}
+
+
 BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, src::logger_mt)
 
 boost::shared_ptr<sinks::synchronous_sink<sinks::text_file_backend>> boostLogger;
@@ -69,6 +78,9 @@ static long transactionCounter = 0;
 
 int main(const int argc, char **argv) {
     sctp_params_t sctpParams;
+
+
+
 #ifdef __TRACING__
     opentracing::Tracer::InitGlobal(tracelibcpp::createTracer("E2 Terminator"));
     auto span = opentracing::Tracer::Global()->StartSpan(__FUNCTION__);
@@ -92,6 +104,20 @@ int main(const int argc, char **argv) {
     init_log();
     mdclog_level_set(MDCLOG_INFO);
 
+    if (std::signal(SIGINT, catch_function) == SIG_ERR) {
+        mdclog_write(MDCLOG_ERR, "Errir initializing SIGINT");
+        exit(1);
+    }
+    if (std::signal(SIGABRT, catch_function)== SIG_ERR) {
+        mdclog_write(MDCLOG_ERR, "Errir initializing SIGABRT");
+        exit(1);
+    }
+    if (std::signal(SIGTERM, catch_function)== SIG_ERR) {
+        mdclog_write(MDCLOG_ERR, "Errir initializing SIGTERM");
+        exit(1);
+    }
+
+
     cpuClock = approx_CPU_MHz(100);
 
     mdclog_write(MDCLOG_DEBUG, "CPU speed %11.11f", cpuClock);
index 597db3a..a33ed21 100644 (file)
@@ -44,6 +44,7 @@
 #include <iterator>
 #include <map>
 #include <sys/inotify.h>
+#include <csignal>
 
 #include <rmr/rmr.h>
 #include <rmr/RIC_message_types.h>
@@ -147,11 +148,11 @@ typedef struct ConnectedCU {
 typedef struct RmrMessagesBuffer {
     char ka_message[4096] {};
     int  ka_message_len = 0;
-    void *rmrCtx;
-    rmr_mbuf_t *sendMessage;
-    rmr_mbuf_t *sendBufferedMessages[MAX_RMR_BUFF_ARRY];
-    rmr_mbuf_t *rcvMessage;
-    rmr_mbuf_t *rcvBufferedMessages[MAX_RMR_BUFF_ARRY];
+    void *rmrCtx = nullptr;
+    rmr_mbuf_t *sendMessage= nullptr;
+    rmr_mbuf_t *sendBufferedMessages[MAX_RMR_BUFF_ARRY] {};
+    rmr_mbuf_t *rcvMessage= nullptr;
+    rmr_mbuf_t *rcvBufferedMessages[MAX_RMR_BUFF_ARRY] {};
 } RmrMessagesBuffer_t;
 
 typedef struct formatedMessage {