From: Saurav Babu Date: Fri, 2 Feb 2018 04:31:19 +0000 (+0530) Subject: comp-manager: Reset retry count when device discovery is in progress X-Git-Tag: submit/tizen/20190131.065036~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fcf3570bcb43f8edf739cba7f5748e2b67121a93;p=platform%2Fcore%2Fapi%2Fmulti-device-group.git comp-manager: Reset retry count when device discovery is in progress Signed-off-by: Saurav Babu --- diff --git a/src/companion-manager/src/comp_group.c b/src/companion-manager/src/comp_group.c index 96e1749..86073e8 100644 --- a/src/companion-manager/src/comp_group.c +++ b/src/companion-manager/src/comp_group.c @@ -355,9 +355,12 @@ void comp_group_notify_mot_enable_device_done(int device_count) notify_device_found(count, device_data); - if (find_mot_enb_dev_retry_cnt < RETRY_COUNT) { - find_mot_enb_dev_retry_cnt += 1; + if (find_mot_enb_dev_retry_cnt <= RETRY_COUNT) { g_timeout_add(RETRY_INTERVAL, __retry_find_mot_enable_device, NULL); + find_mot_enb_dev_retry_cnt += 1; + } else { + LOG_DEBUG("Find MOT enabled device finished"); + find_mot_enb_dev_retry_cnt = 0; } LOG_END(); @@ -373,7 +376,11 @@ int comp_group_find_mot_enabled_devices(int timeout) g_list_free_full (mot_enb_dev_list, _mot_enb_dev_list_free_func); mot_enb_dev_list = NULL; - find_mot_enb_dev_retry_cnt = 0; + if (find_mot_enb_dev_retry_cnt != 0) { + find_mot_enb_dev_retry_cnt = 1; + LOG_DEBUG("Find MOT enables devices in progress, reset retry count"); + return COMP_ERROR_NONE; + } ret = agent_find_mot_enable_devices(timeout); if (ret != COMP_ERROR_NONE) { @@ -797,9 +804,12 @@ void comp_group_notify_mowned_device_find_done(int device_count) notify_mowned_device_found(count, device_data); - if (find_mowned_dev_retry_cnt < RETRY_COUNT) { - find_mowned_dev_retry_cnt += 1; + if (find_mowned_dev_retry_cnt <= RETRY_COUNT) { g_timeout_add(RETRY_INTERVAL, __retry_find_mowned_devices, NULL); + find_mowned_dev_retry_cnt += 1; + } else { + LOG_DEBUG("Find My owned devices finished"); + find_mowned_dev_retry_cnt = 0; } LOG_END(); @@ -815,7 +825,11 @@ int comp_group_find_mowned_devices(int timeout) g_list_free_full(mowned_dev_list, _mot_enb_dev_list_free_func); mowned_dev_list = NULL; - find_mowned_dev_retry_cnt = 0; + if (find_mowned_dev_retry_cnt != 0) { + find_mowned_dev_retry_cnt = 1; + LOG_DEBUG("Find My owned devices in progress, reset retry count"); + return COMP_ERROR_NONE; + } ret = agent_find_mowned_devices(timeout); if (ret != COMP_ERROR_NONE) {