fix,srsenb: start stack before the radio to avoid stack methods to be called when stack is not fully initialized

master
Francisco 3 years ago committed by Francisco Paisana
parent e8983b88f0
commit f55e1c5a73

@ -140,7 +140,7 @@ private:
phy_interface_stack_lte* phy = nullptr;
// state
bool started = false;
std::atomic<bool> started{false};
srsran::dyn_blocking_queue<stack_metrics_t> pending_stack_metrics;
};

@ -70,6 +70,14 @@ int enb::init(const all_args_t& args_)
return SRSRAN_ERROR;
}
// Only init Stack if both radio and PHY could be initialized
if (ret == SRSRAN_SUCCESS) {
if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get()) != SRSRAN_SUCCESS) {
srsran::console("Error initializing stack.\n");
ret = SRSRAN_ERROR;
}
}
// Init Radio
if (lte_radio->init(args.rf, lte_phy.get())) {
srsran::console("Error initializing radio.\n");
@ -84,14 +92,6 @@ int enb::init(const all_args_t& args_)
}
}
// Only init Stack if both radio and PHY could be initialized
if (ret == SRSRAN_SUCCESS) {
if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get()) != SRSRAN_SUCCESS) {
srsran::console("Error initializing stack.\n");
ret = SRSRAN_ERROR;
}
}
stack = std::move(lte_stack);
phy = std::move(lte_phy);
radio = std::move(lte_radio);

@ -226,7 +226,7 @@ bool enb_stack_lte::get_metrics(stack_metrics_t* metrics)
void enb_stack_lte::run_thread()
{
while (started) {
while (started.load(std::memory_order_relaxed)) {
task_sched.run_next_task();
}
}

Loading…
Cancel
Save