From 71ebac861c1f6291134bfde9f81d8cb70981702b Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 11 Oct 2019 18:23:25 +0100 Subject: [PATCH] fix nas proc logging, and reuse of cell selection result --- srsue/src/stack/rrc/rrc_procedures.cc | 14 +++++++++++--- srsue/src/stack/upper/nas.cc | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index 5a677e188..43735f165 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -584,14 +584,22 @@ proc_outcome_t rrc::connection_request_proc::init(rrc* // Launch failed but cell selection was not already running Error("Failed to initiate cell selection procedure...\n"); return proc_outcome_t::error; + } else if (not rrc_ptr->cell_selector.is_complete()) { + // In case it was already running, just wait for an cell_selection_complete event trigger + Info("Cell selection proc already on-going. Wait for its result\n"); + } else { + // It already completed with success. FIXME: Find more elegant solution + Info("A cell selection procedure has just finished successfully. I am reusing its result\n"); + cell_selection_complete e{}; + e.is_success = rrc_ptr->cell_selector.get()->is_success(); + e.cs_result = rrc_ptr->cell_selector.get()->get_cs_result(); + return trigger_event(e); } - // In case it was already running, just wait for an cell_selection_complete event trigger - Info("Cell selection proc already on-going. Wait for its result\n"); } else { // In case we were able to launch it, let the callback list handle it rrc_ptr->callback_list.defer_proc(rrc_ptr->cell_selector); } - return proc_outcome_t::repeat; + return proc_outcome_t::yield; } proc_outcome_t rrc::connection_request_proc::step() diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index f2f8702e1..1ced49563 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -36,9 +36,9 @@ using namespace srslte; -#define Error(fmt, ...) nas_ptr->nas_log->error("%s - " fmt, name(), ##__VA_ARGS__) -#define Warning(fmt, ...) nas_ptr->nas_log->warning("%s - " fmt, name(), ##__VA_ARGS__) -#define Info(fmt, ...) nas_ptr->nas_log->info("%s - " fmt, name(), ##__VA_ARGS__) +#define Error(fmt, ...) nas_ptr->nas_log->error("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__) +#define Warning(fmt, ...) nas_ptr->nas_log->warning("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__) +#define Info(fmt, ...) nas_ptr->nas_log->info("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__) namespace srsue { @@ -157,12 +157,12 @@ nas::rrc_connect_proc::init(nas* nas_ptr_, srslte::establishment_cause_t cause_, nas_ptr->rrc->set_ue_identity(s_tmsi); } + Info("Starting...\n"); state = state_t::conn_req; if (not nas_ptr->start_connection_request(cause_, std::move(pdu))) { return proc_outcome_t::error; } - Info("Starting...\n"); return proc_outcome_t::yield; }