ue_stack_lte: make sure to execute stack commands on Stack thread

some commands were executed from the calling thread which may lead
to concurrent access to members. Detected by TSAN. The patch
moves all remaining calls (the majority was alread moved) to the
Stack task queue.
This commit is contained in:
Andre Puschmann 2021-06-09 16:39:54 +02:00
parent a9ad408f51
commit 3173dedf0a
1 changed files with 30 additions and 19 deletions

View File

@ -271,6 +271,8 @@ bool ue_stack_lte::switch_on()
bool ue_stack_lte::switch_off()
{
if (running) {
ue_task_queue.try_push([this]() {
// generate detach request with switch-off flag
nas.switch_off();
@ -279,27 +281,36 @@ bool ue_stack_lte::switch_off()
while (not rrc.srbs_flushed() && ++cnt <= timeout_ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
bool detach_sent = true;
if (not rrc.srbs_flushed()) {
srslog::fetch_basic_logger("NAS").warning("Detach couldn't be sent after %dms.", timeout_ms);
detach_sent = false;
}
return detach_sent;
});
}
return true;
}
bool ue_stack_lte::enable_data()
{
if (running) {
ue_task_queue.try_push([this]() {
// perform attach request
srsran::console("Turning off airplane mode.\n");
return nas.enable_data();
nas.enable_data();
});
}
return true;
}
bool ue_stack_lte::disable_data()
{
if (running) {
ue_task_queue.try_push([this]() {
// generate detach request
srsran::console("Turning on airplane mode.\n");
return nas.disable_data();
nas.disable_data();
});
}
return true;
}
bool ue_stack_lte::start_service_request()