ue: move blocking wait for detach outside of stack class

the thread sleep waiting for the UE release should not run
on the stack thread. Move it to the UE class therefore.
This commit is contained in:
Andre Puschmann 2021-06-28 11:00:17 +02:00
parent bbcaa49429
commit 5999b0d3a5
2 changed files with 20 additions and 10 deletions

View File

@ -275,15 +275,6 @@ bool ue_stack_lte::switch_off()
ue_task_queue.try_push([this]() {
// generate detach request with switch-off flag
nas.switch_off();
// wait for max. 5s for it to be sent (according to TS 24.301 Sec 25.5.2.2)
int cnt = 0, timeout_ms = 5000;
while (not rrc.srbs_flushed() && ++cnt <= timeout_ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
if (not rrc.srbs_flushed()) {
srslog::fetch_basic_logger("NAS").warning("Detach couldn't be sent after %dms.", timeout_ms);
}
});
}
return true;

View File

@ -301,7 +301,26 @@ bool ue::switch_off()
if (gw_inst) {
gw_inst->stop();
}
return stack->switch_off();
// send switch off
stack->switch_off();
// wait for max. 5s for it to be sent (according to TS 24.301 Sec 25.5.2.2)
int cnt = 0, timeout_s = 5;
stack_metrics_t metrics = {};
stack->get_metrics(&metrics);
while (metrics.rrc.state != RRC_STATE_IDLE && ++cnt <= timeout_s) {
std::this_thread::sleep_for(std::chrono::seconds(1));
stack->get_metrics(&metrics);
}
if (metrics.rrc.state != RRC_STATE_IDLE) {
srslog::fetch_basic_logger("NAS").warning("Detach couldn't be sent after %ds.", timeout_s);
return false;
}
return true;
}
void ue::start_plot()