From c1fee62473084fe6b75d56172c4954d20622992d Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Fri, 20 Jan 2017 15:05:28 +0100
Subject: [PATCH] RA: fix allocation of RA process

A RA process is not available if
and RA_template[i].wait_ack_Msg4 != 0

We can have RA_active==FALSE and wait_ack_Msg4==1,
in which case the RA process is in use and cannot
be reassigned.
---
 openair2/LAYER2/MAC/eNB_scheduler_RA.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 195c78c538..8ff409978e 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -747,7 +747,8 @@ void initiate_ra_proc(module_id_t module_idP, int CC_id,frame_t frameP, uint16_t
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC,0);
 
   for (i=0; i<NB_RA_PROC_MAX; i++) {
-    if (RA_template[i].RA_active==FALSE) {
+    if (RA_template[i].RA_active==FALSE &&
+        RA_template[i].wait_ack_Msg4 == 0) {
       RA_template[i].RA_active=TRUE;
       RA_template[i].generate_rar=1;
       RA_template[i].generate_Msg4=0;
-- 
GitLab