added extra logging and removed uneeded member from proc_t

This commit is contained in:
Francisco Paisana 2019-10-21 20:00:02 +01:00 committed by Andre Puschmann
parent b254bdbb93
commit 248583ecdf
2 changed files with 15 additions and 16 deletions

View File

@ -306,7 +306,7 @@ public:
proc_future_type get_future() proc_future_type get_future()
{ {
if (future_result == nullptr) { if (future_result == nullptr) {
future_result = std::make_shared<proc_result_type>(proc_result); future_result = std::make_shared<proc_result_type>();
} }
return proc_future_type{future_result}; return proc_future_type{future_result};
} }
@ -342,30 +342,28 @@ protected:
void run_then(bool is_success) final void run_then(bool is_success) final
{ {
proc_result_type result;
// update result state // update result state
if (is_success) { if (is_success) {
proc_result.extract_val(*proc_ptr); result.extract_val(*proc_ptr);
} else { } else {
proc_result.set_error(); result.set_error();
} }
// call T::then() if it exists
proc_detail::optional_then(proc_ptr.get(), proc_result);
// signal continuations
complete_callbacks(proc_result);
// propagate proc_result to future if it exists, and release future // propagate proc_result to future if it exists, and release future
if (future_result != nullptr) { if (future_result != nullptr) {
*future_result = proc_result; *future_result = result;
future_result.reset(); future_result.reset();
} }
// reset the current result, to prepare it for a new run. // call T::then() if it exists
proc_result.clear(); proc_detail::optional_then(proc_ptr.get(), result);
// signal continuations
complete_callbacks(result);
// back to inactive // back to inactive
proc_detail::optional_clear(proc_ptr.get()); proc_detail::optional_clear(proc_ptr.get());
proc_state = proc_status_t::idle; proc_state = proc_status_t::idle;
} }
std::unique_ptr<T> proc_ptr; std::unique_ptr<T> proc_ptr;
proc_result_type proc_result;
std::shared_ptr<proc_result_type> future_result; //! used if get_future() itf is used. std::shared_ptr<proc_result_type> future_result; //! used if get_future() itf is used.
then_callback_list_t complete_callbacks; then_callback_list_t complete_callbacks;
}; };

View File

@ -333,6 +333,7 @@ proc_outcome_t rrc::cell_selection_proc::init()
if (rrc_ptr->neighbour_cells.empty() and rrc_ptr->serving_cell->in_sync and rrc_ptr->phy->cell_is_camping()) { if (rrc_ptr->neighbour_cells.empty() and rrc_ptr->serving_cell->in_sync and rrc_ptr->phy->cell_is_camping()) {
// don't bother with cell selection if there are no neighbours and we are already camping // don't bother with cell selection if there are no neighbours and we are already camping
Debug("Skipping Cell Selection Procedure ..\n"); Debug("Skipping Cell Selection Procedure ..\n");
cs_result = cs_result_t::same_cell;
return proc_outcome_t::success; return proc_outcome_t::success;
} }
@ -825,12 +826,11 @@ proc_outcome_t rrc::go_idle_proc::step()
* Cell Reselection procedure * Cell Reselection procedure
*************************************/ *************************************/
rrc::cell_reselection_proc::cell_reselection_proc(srsue::rrc* rrc_) rrc::cell_reselection_proc::cell_reselection_proc(srsue::rrc* rrc_) : rrc_ptr(rrc_) {}
: rrc_ptr(rrc_) {}
proc_outcome_t rrc::cell_reselection_proc::init() proc_outcome_t rrc::cell_reselection_proc::init()
{ {
Info("Cell Reselection - Starting...\n"); Info("Starting...\n");
if (not rrc_ptr->cell_selector.launch()) { if (not rrc_ptr->cell_selector.launch()) {
Error("Failed to initiate a Cell Selection procedure...\n"); Error("Failed to initiate a Cell Selection procedure...\n");
return proc_outcome_t::error; return proc_outcome_t::error;
@ -846,13 +846,14 @@ proc_outcome_t rrc::cell_reselection_proc::step()
return srslte::proc_outcome_t::yield; return srslte::proc_outcome_t::yield;
} }
if (cell_selection_fut.is_error()) { if (cell_selection_fut.is_error()) {
Error("Cell Reselection - Error while selecting a cell\n"); Error("Error while selecting a cell\n");
return srslte::proc_outcome_t::error; return srslte::proc_outcome_t::error;
} }
Info("Cell Selection completed. Handling its result...\n");
switch (*cell_selection_fut.value()) { switch (*cell_selection_fut.value()) {
case cs_result_t::changed_cell: case cs_result_t::changed_cell:
// New cell has been selected, start receiving PCCH Info("New cell has been selected, start receiving PCCH\n");
rrc_ptr->mac->pcch_start_rx(); rrc_ptr->mac->pcch_start_rx();
break; break;
case cs_result_t::no_cell: case cs_result_t::no_cell: