Commit 97ddf5ea authored by Cedric Roux's avatar Cedric Roux

basic simulator: bugfix: wait for synch ready at the right time

Before this commit we were checking for UE->is_synchronized == 0
then we were waiting for a potentially active synch routine to
finish and then we were starting the synch routine again but the
synch routine that was running may have set UE->is_synchronized
to 1. This was leading to various problems, most notably the following
message repeated over and over in the UE log and the UE unable to
connect properly:

    [RRC]  [UE 0] Frame 377: OUT OF SYNC FROM eNB 0 (T310 active 0 : T310 0, N310 345, N311 0)

So let's wait for a potentially active synch routine to finish
before anything else.
parent 2276996f
...@@ -1459,18 +1459,19 @@ void *UE_thread(void *arg) { ...@@ -1459,18 +1459,19 @@ void *UE_thread(void *arg) {
while (!oai_exit) { while (!oai_exit) {
#if BASIC_SIMULATOR
while (!(UE->proc.instance_cnt_synch < 0)) {
printf("ue sync not ready\n");
usleep(500*1000);
}
#endif
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
int instance_cnt_synch = UE->proc.instance_cnt_synch; int instance_cnt_synch = UE->proc.instance_cnt_synch;
int is_synchronized = UE->is_synchronized; int is_synchronized = UE->is_synchronized;
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
if (is_synchronized == 0) { if (is_synchronized == 0) {
#if BASIC_SIMULATOR
while (!((instance_cnt_synch = UE->proc.instance_cnt_synch) < 0)) {
printf("ue sync not ready\n");
usleep(500*1000);
}
#endif
if (instance_cnt_synch < 0) { // we can invoke the synch if (instance_cnt_synch < 0) { // we can invoke the synch
// grab 10 ms of signal and wakeup synch thread // grab 10 ms of signal and wakeup synch thread
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment