- fixes crash on initialization. Now the program exits cleanly

This commit is contained in:
AlaiaL 2021-02-03 08:51:41 +01:00 committed by AlaiaL
parent a8099d0df9
commit f1cd4b1f0d
3 changed files with 13 additions and 4 deletions

View File

@ -93,7 +93,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
// 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())) {
if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get()) != SRSLTE_SUCCESS) {
srslte::console("Error initializing stack.\n");
ret = SRSLTE_ERROR;
}

View File

@ -123,7 +123,11 @@ int enb_stack_lte::init(const stack_args_t& args_, const rrc_cfg_t& rrc_cfg_)
sync_task_queue = task_sched.make_task_queue(args.sync_queue_size);
// Init all layers
mac.init(args.mac, rrc_cfg.cell_list, phy, &rlc, &rrc, mac_log);
if (! mac.init(args.mac, rrc_cfg.cell_list, phy, &rlc, &rrc, mac_log))
{
stack_logger.error("Couldn't initialize MAC");
return SRSLTE_ERROR;
}
rlc.init(&pdcp, &rrc, &mac, task_sched.get_timer_handler());
pdcp.init(&rlc, &rrc, &gtpu);
rrc.init(rrc_cfg, phy, &mac, &rlc, &pdcp, &s1ap, &gtpu);

View File

@ -79,8 +79,13 @@ bool mac::init(const mac_args_t& args_,
reset();
// Pre-alloc UE objects for first attaching users
prealloc_ue(10);
try {
// Pre-alloc UE objects for first attaching users
prealloc_ue(10);
}catch(const std::bad_alloc& e){
perror("Error allocating data during the ue prealloc");
return false;
}
detected_rachs.resize(cells.size());