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.
master
Andre Puschmann 4 years ago
parent bbcaa49429
commit 5999b0d3a5

@ -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;

@ -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()

Loading…
Cancel
Save