diff --git a/srsenb/src/upper/rrc.cc b/srsenb/src/upper/rrc.cc index 19a8dc073..4a1477a2d 100644 --- a/srsenb/src/upper/rrc.cc +++ b/srsenb/src/upper/rrc.cc @@ -308,16 +308,22 @@ void rrc::rem_user(uint16_t rnti) if (users.count(rnti) == 1) { rrc_log->console("Disconnecting rnti=0x%x.\n", rnti); rrc_log->info("Disconnecting rnti=0x%x.\n", rnti); - /* **Caution** order of removal here is important: from bottom to top */ + + /* First remove MAC and GTPU to stop processing DL/UL traffic for this user + */ mac->ue_rem(rnti); // MAC handles PHY + gtpu->rem_user(rnti); + // Wait enough time pthread_mutex_unlock(&user_mutex); usleep(50000); pthread_mutex_lock(&user_mutex); + // Now remove RLC and PDCP rlc->rem_user(rnti); pdcp->rem_user(rnti); - gtpu->rem_user(rnti); + + // And deallocate resources from RRC users[rnti].sr_free(); users[rnti].cqi_free(); users.erase(rnti);