enb: fix eNB shutdown if layers cant be initialized

this fixed #1392 which ocurrured because we were going on with the eNB
init even if the radio failed to initialize
master
Andre Puschmann 5 years ago
parent 039f2164a6
commit db7478e9f0

@ -79,31 +79,41 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
return SRSLTE_ERROR;
}
// Init layers
// Init Radio
if (lte_radio->init(args.rf, lte_phy.get())) {
log.console("Error initializing radio.\n");
ret = SRSLTE_ERROR;
}
// Only Init PHY if radio couldn't be initialized
if (ret == SRSLTE_SUCCESS) {
if (lte_phy->init(args.phy, phy_cfg, lte_radio.get(), lte_stack.get())) {
log.console("Error initializing PHY.\n");
ret = SRSLTE_ERROR;
}
}
// Only init Stack if both radio and PHY could be initialized
if (ret == SRSLTE_SUCCESS) {
if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get())) {
log.console("Error initializing stack.\n");
ret = SRSLTE_ERROR;
}
}
stack = std::move(lte_stack);
phy = std::move(lte_phy);
radio = std::move(lte_radio);
started = true; // set to true in any case to allow stopping the eNB if an error happened
if (ret == SRSLTE_SUCCESS) {
log.console("\n==== eNodeB started ===\n");
log.console("Type <t> to view trace\n");
started = (ret == SRSLTE_SUCCESS);
} else {
// if any of the layers failed to start, make sure the rest is stopped in a controlled manner
stop();
}
return ret;
}

Loading…
Cancel
Save