Fix for sta_get_events failure while executing NAN test scripts
Ensure sta_get_events gets the events only after joining the NAN
cluster. After NAN enable, we either wait for 30 seconds or till we join
the NAN cluster before doing the sta_get_events get.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
diff --git a/nan.c b/nan.c
index dc1deff..a492aa0 100644
--- a/nan.c
+++ b/nan.c
@@ -319,9 +319,14 @@
}
nan_enable_request(0, global_interface_handle, &req);
- abstime.tv_sec = 4;
+
+ /* To ensure sta_get_events to get the events
+ * only after joining the NAN cluster. */
+ abstime.tv_sec = 30;
abstime.tv_nsec = 0;
- return wait(abstime);
+ wait(abstime);
+
+ return 0;
}
@@ -334,7 +339,9 @@
abstime.tv_sec = 4;
abstime.tv_nsec = 0;
- return wait(abstime);
+ wait(abstime);
+
+ return 0;
}
@@ -376,8 +383,9 @@
abstime.tv_sec = 4;
abstime.tv_nsec = 0;
+ wait(abstime);
- return wait(abstime);
+ return 0;
}
@@ -637,10 +645,11 @@
}
nan_enable_request(0, global_interface_handle, &req);
+
abstime.tv_sec = 4;
abstime.tv_nsec = 0;
-
wait(abstime);
+
return 0;
}
@@ -954,6 +963,9 @@
MAC_ADDR_STR,
__func__,
MAC_ADDR_ARRAY(event->data.cluster.addr));
+ /* To ensure sta_get_events to get the events
+ * only after joining the NAN cluster. */
+ pthread_cond_signal(&gCondition);
}
if (event->event_type == NAN_EVENT_ID_STARTED_CLUSTER) {
sigma_dut_print(global_dut, DUT_MSG_INFO,
@@ -970,7 +982,6 @@
memcpy(global_nan_mac_addr, event->data.mac_addr.addr,
sizeof(global_nan_mac_addr));
}
- pthread_cond_signal(&gCondition);
}