From 51d2751dd7a80db107e4919759ea347b38fe81e8 Mon Sep 17 00:00:00 2001 From: "sung.goo.kim" Date: Thu, 30 Jun 2016 08:16:55 +0900 Subject: [PATCH] [UTC][IoTCon][Non-ACR][Fix failed TC (stop_monitoring_p, sometimes)] Change-Id: I221df19b96e615146b15a0b5515f8954eeee6156 --- src/utc/iotcon/utc-iotcon-encap.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/utc/iotcon/utc-iotcon-encap.c b/src/utc/iotcon/utc-iotcon-encap.c index ee0d103..1e86db5 100755 --- a/src/utc/iotcon/utc-iotcon-encap.c +++ b/src/utc/iotcon/utc-iotcon-encap.c @@ -233,6 +233,20 @@ static void _encap_monitoring_cb(iotcon_remote_resource_h resource, } } +static gboolean _destroy_lite_light_resource(gpointer p) +{ + FN_CALL; + int ret; + + ret = iotcon_lite_resource_destroy(g_lite_light_resource); + if (IOTCON_ERROR_NONE != ret) + ICUTC_ERR("iotcon_lite_resource_destroy() Fail(%d)", ret); + + g_lite_light_resource = NULL; + + return G_SOURCE_REMOVE; +} + static bool _encap_found_resource(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data) { @@ -354,6 +368,7 @@ static bool _encap_found_resource(iotcon_remote_resource_h resource, _encap_main_loop_quit(false); return IOTCON_FUNC_STOP; } + g_timeout_add_seconds(3, _destroy_lite_light_resource, NULL); return IOTCON_FUNC_STOP; case ENCAP_START_MONITORING_N: ret = iotcon_remote_resource_start_monitoring(NULL, _encap_monitoring_cb, @@ -415,20 +430,6 @@ static bool _encap_found_resource(iotcon_remote_resource_h resource, return IOTCON_FUNC_STOP; } -static gboolean _destroy_lite_light_resource(gpointer p) -{ - FN_CALL; - int ret; - - ret = iotcon_lite_resource_destroy(g_lite_light_resource); - if (IOTCON_ERROR_NONE != ret) - ICUTC_ERR("iotcon_lite_resource_destroy() Fail(%d)", ret); - - g_lite_light_resource = NULL; - - return G_SOURCE_REMOVE; -} - static int _encap_handle_async(int tc_index) { FN_CALL; @@ -439,9 +440,6 @@ static int _encap_handle_async(int tc_index) ret = _encap_create_lite_resource(); ICUTC_ASSERT_EQ(ret, 0); - if (ENCAP_STOP_MONITORING_P == tc_index) - g_timeout_add_seconds(3, _destroy_lite_light_resource, NULL); - ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_IPV4, ENCAP_LIGHT_RESOURCE_TYPE, false, _encap_found_resource, (void *)tc_index); ICUTC_ASSERT_EQ(ret, IOTCON_ERROR_NONE); -- 2.7.4