diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index cf5901e84..3f821f0fe 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -153,8 +153,8 @@ private: srslog::sink& log_sink; srslog::basic_logger& enb_log; - all_args_t args = {}; - bool started = false; + all_args_t args = {}; + std::atomic started = {false}; phy_cfg_t phy_cfg = {}; rrc_cfg_t rrc_cfg = {}; @@ -164,8 +164,8 @@ private: x2_adapter x2; std::unique_ptr eutra_stack = nullptr; std::unique_ptr nr_stack = nullptr; - std::unique_ptr radio = nullptr; - std::unique_ptr phy = nullptr; + std::unique_ptr radio = nullptr; + std::unique_ptr phy = nullptr; // System metrics processor. srsran::sys_metrics_processor sys_proc; diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index da2bbdc2d..050168669 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -194,12 +194,15 @@ void enb::print_pool() bool enb::get_metrics(enb_metrics_t* m) { + if (!started) { + return false; + } radio->get_metrics(&m->rf); phy->get_metrics(m->phy); if (eutra_stack) { eutra_stack->get_metrics(&m->stack); } - m->running = started; + m->running = true; m->sys = sys_proc.get_metrics(); return true; } @@ -231,6 +234,9 @@ std::string enb::get_build_string() void enb::toggle_padding() { + if (!started) { + return; + } if (eutra_stack) { eutra_stack->toggle_padding(); } @@ -238,6 +244,9 @@ void enb::toggle_padding() void enb::tti_clock() { + if (!started) { + return; + } if (eutra_stack) { eutra_stack->tti_clock(); }