From bf25a5a05cfbc56128e2bbd1df00a1c3da18ea52 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 28 Mar 2018 16:46:40 +0200 Subject: [PATCH] fix handling of log vector in eNB --- srsenb/hdr/enb.h | 2 +- srsenb/hdr/phy/phy.h | 5 +++-- srsenb/src/enb.cc | 5 ++++- srsenb/src/phy/phy.cc | 10 +++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index ff314977a..6d2a78b44 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -188,7 +188,7 @@ private: srslte::logger *logger; srslte::log_filter rf_log; - std::vector phy_log; + std::vector phy_log; srslte::log_filter mac_log; srslte::log_filter rlc_log; srslte::log_filter pdcp_log; diff --git a/srsenb/hdr/phy/phy.h b/srsenb/hdr/phy/phy.h index a1616c268..99b23de0c 100644 --- a/srsenb/hdr/phy/phy.h +++ b/srsenb/hdr/phy/phy.h @@ -28,6 +28,7 @@ #define ENBPHY_H #include "srslte/common/log.h" +#include "srslte/common/log_filter.h" #include "phy/txrx.h" #include "phy/phch_worker.h" #include "phy/phch_common.h" @@ -54,8 +55,8 @@ class phy : public phy_interface_mac, public: phy(); - bool init(phy_args_t *args, phy_cfg_t *common_cfg, srslte::radio *radio_handler, mac_interface_phy *mac, srslte::log* log_h); - bool init(phy_args_t *args, phy_cfg_t *common_cfg, srslte::radio *radio_handler, mac_interface_phy *mac, std::vector log_vec); + bool init(phy_args_t *args, phy_cfg_t *common_cfg, srslte::radio *radio_handler, mac_interface_phy *mac, srslte::log_filter* log_h); + bool init(phy_args_t *args, phy_cfg_t *common_cfg, srslte::radio *radio_handler, mac_interface_phy *mac, std::vector log_vec); void stop(); /* MAC->PHY interface */ diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 564775e5e..6e5e06669 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -67,6 +67,9 @@ enb::enb() : started(false) { enb::~enb() { + for (uint32_t i = 0; i < phy_log.size(); i++) { + delete (phy_log[i]); + } } bool enb::init(all_args_t *args_) @@ -89,7 +92,7 @@ bool enb::init(all_args_t *args_) char tmp[16]; sprintf(tmp, "PHY%d",i); mylog->init(tmp, logger, true); - phy_log.push_back((void*) mylog); + phy_log.push_back(mylog); } mac_log.init("MAC ", logger, true); rlc_log.init("RLC ", logger); diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index d47998fa9..08b89d77f 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -92,12 +92,12 @@ void phy::parse_config(phy_cfg_t* cfg) bool phy::init(phy_args_t *args, phy_cfg_t *cfg, srslte::radio* radio_handler_, - mac_interface_phy *mac, - srslte::log* log_h) + mac_interface_phy *mac, + srslte::log_filter* log_h) { - std::vector log_vec; + std::vector log_vec; for (int i=0;inof_phy_threads;i++) { - log_vec.push_back((void*)log_h); + log_vec.push_back(log_h); } init(args, cfg, radio_handler_, mac, log_vec); return true; @@ -107,7 +107,7 @@ bool phy::init(phy_args_t *args, phy_cfg_t *cfg, srslte::radio* radio_handler_, mac_interface_phy *mac, - std::vector log_vec) + std::vector log_vec) { mlockall(MCL_CURRENT | MCL_FUTURE);