diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 8ad6b5c8e6..6ef8149bb1 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3070,7 +3070,10 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { ue_context_p, NGAP_CAUSE_RADIO_NETWORK, 30); - }else{ + } + + // Remove here the MAC and RRC context when RRC is not connected or gNB is not connected to CN5G + if(ue_context_p->ue_context.StatusRrc < NR_RRC_CONNECTED || ue_context_p->ue_context.gNB_ue_ngap_id == 0) { mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti); rrc_rlc_remove_ue(ctxt_pP); pdcp_remove_UE(ctxt_pP); @@ -3082,6 +3085,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti); } } + break; // break RB_FOREACH } }