It is not notify about state of finding to caller.
So we will return 'OC_STACK_ERROR' when It was finding a group.
User should be wait findCallback.
Then user will know the result of finding.
FindCallback has the argument which OCResource.
If it is NULL we could not find a group.
Fix [IOT-286]
Change-Id: I2b95d5102e54e4242394c36d51de81f192b87e13
Signed-off-by: HyunJun Kim <hyunjun2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/230
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
{
GroupSynchronization* GroupSynchronization::groupSyncnstance = NULL;
+ bool GroupSynchronization::bIsFinding = false;
GroupSynchronization* GroupSynchronization::getInstance()
{
{
cout << "GroupSynchronization::findGroup" << endl;
+ if(bIsFinding)
+ return OC_STACK_ERROR;
+
foundGroupResourceList.clear();
findCallback = callback;
std::bind(&GroupSynchronization::onFindGroup, this, std::placeholders::_1));
}
+ bIsFinding = true;
+
// thread to check if GroupSynchronization::onFoundGroup is called or not.
std::thread t(std::bind(&GroupSynchronization::checkFindGroup, this));
t.detach();
findCallback(NULL);
}
+ bIsFinding = false;
}
catch (std::exception& e)
{
std::shared_ptr< OCResourceRequest > resourceRequest; // this is used for slow response
static GroupSynchronization* groupSyncnstance;
+ static bool bIsFinding;
GroupSynchronization()
{