From eb3b87d9569bcc6229b529a11969c465eb6c19ac Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Wed, 8 Aug 2018 11:58:26 +0200
Subject: [PATCH] T: bugfix and cleanup

- bug fixed in ue and enb tracer: the socket needs to be closed
  in case of restart
- cleanup: fix spacing in T_messages.txt
---
 common/utils/T/T_messages.txt | 2 ++
 common/utils/T/tracer/enb.c   | 1 +
 common/utils/T/tracer/ue.c    | 1 +
 3 files changed, 4 insertions(+)

diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index fd4425063b6..9432155147e 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -749,6 +749,7 @@ ID = LEGACY_OSA_TRACE
     DESC = OSA legacy logs - trace level
     GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY
     FORMAT = string,log
+
 ID = LEGACY_SIM_INFO
     DESC = SIM legacy logs - info level
     GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_INFO:LEGACY
@@ -769,6 +770,7 @@ ID = LEGACY_SIM_TRACE
     DESC = SIM legacy logs - trace level
     GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
     FORMAT = string,log
+
 # this is a bad hack but I won't fix (function util_print_hex_octets
 # in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
 # does funky things with the LOG_x macros but we work on the C pre-processor
diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c
index a30366faf1e..ea499a68f83 100644
--- a/common/utils/T/tracer/enb.c
+++ b/common/utils/T/tracer/enb.c
@@ -878,6 +878,7 @@ int main(int n, char **v)
 
 restart:
   clear_remote_config();
+  if (enb_data.socket != -1) close(enb_data.socket);
   enb_data.socket = connect_to(ip, port);
 
   /* send the first message - activate selected traces */
diff --git a/common/utils/T/tracer/ue.c b/common/utils/T/tracer/ue.c
index 6a7d03c8973..7b03210cd2c 100644
--- a/common/utils/T/tracer/ue.c
+++ b/common/utils/T/tracer/ue.c
@@ -857,6 +857,7 @@ int main(int n, char **v)
 
 restart:
   clear_remote_config();
+  if (ue_data.socket != -1) close(ue_data.socket);
   ue_data.socket = connect_to(ip, port);
 
   /* send the first message - activate selected traces */
-- 
GitLab