Add polling interval validation check 33/119533/1 accepted/tizen/common/20170321.102123 accepted/tizen/ivi/20170321.094945 accepted/tizen/mobile/20170321.094827 accepted/tizen/tv/20170321.094850 accepted/tizen/unified/20170321.094950 accepted/tizen/wearable/20170321.094925 submit/tizen/20170321.001539
authorJooseok Park <jooseok.park@samsung.com>
Fri, 17 Mar 2017 07:34:18 +0000 (16:34 +0900)
committerJooseok Park <jooseok.park@samsung.com>
Fri, 17 Mar 2017 07:34:18 +0000 (16:34 +0900)
Change-Id: I3b9e63f5df1d2cd01d2694125229e6acd5051bee

packaging/iotcon.spec
src/ic-ioty-ocprocess.c
src/ic-ioty.c
src/ic.c

index 6e9dbe9..f53e5aa 100644 (file)
@@ -1,6 +1,6 @@
 Name:       iotcon
 Summary:    Tizen IoT Connectivity
-Version:    0.3.13
+Version:    0.3.14
 Release:    0
 Group:      Network & Connectivity/Service
 License:    Apache-2.0
index 36befbe..3b724b1 100644 (file)
@@ -123,6 +123,7 @@ static gboolean _icl_ioty_ocprocess_find_idle_cb(gpointer p)
 
                                break;
                        }
+                       INFO("Call the callback done");
                        resource->is_found = false;
                }
        }
@@ -168,6 +169,10 @@ OCStackApplicationResult icl_ioty_ocprocess_find_cb(void *ctx, OCDoHandle handle
 
        RETV_IF(NULL == ctx, OC_STACK_KEEP_TRANSACTION);
        RETV_IF(NULL == resp, OC_STACK_KEEP_TRANSACTION);
+       if (OC_STACK_NO_RESOURCE == resp->result) {
+               DBG("No Resource on [%s:%d]", resp->devAddr.addr, resp->devAddr.port);
+               return OC_STACK_KEEP_TRANSACTION;
+       }
        RETV_IF(NULL == resp->payload, OC_STACK_KEEP_TRANSACTION); /* normal case : payload COULD be NULL */
        RETVM_IF(PAYLOAD_TYPE_DISCOVERY != resp->payload->type,
                        OC_STACK_KEEP_TRANSACTION, "Invalid payload type(%d)", resp->payload->type);
@@ -626,7 +631,10 @@ static gboolean _icl_ioty_ocprocess_request_idle_cb(gpointer p)
        resource = req_container->resource;
        request = req_container->request;
 
+       DBG("resource:[%p], resource->cb:[%p] on [%s]", resource, resource->cb, resource->uri_path);
        resource->cb(resource, request, resource->user_data);
+       DBG("callback done");
+
        icl_destroy_request_container(req_container);
 
        return G_SOURCE_REMOVE;
@@ -742,6 +750,8 @@ OCEntityHandlerResult icl_ioty_ocprocess_request_cb(OCEntityHandlerFlag flag,
        req_container->request = req;
        req_container->resource = resource;
 
+       DBG("req_type [%d], obs_type [%d]", req_type, obs_type);
+
        g_idle_add(_icl_ioty_ocprocess_request_idle_cb, req_container);
 
        return OC_EH_SLOW;
index 8408383..6e6288a 100644 (file)
@@ -295,6 +295,7 @@ static gboolean _icl_ioty_timeout(gpointer user_data)
        cb_info->timeout = 0;
 
        if (cb_info->cb) {
+               DBG("Call the callback : op [%d], handle [%p], cb [%p]", cb_info->op, cb_info->handle, cb_info->cb);
                switch (cb_info->op) {
                case ICL_FIND_RESOURCE:
                        ((iotcon_found_resource_cb)cb_info->cb)(NULL, IOTCON_ERROR_TIMEOUT,
@@ -313,7 +314,7 @@ static gboolean _icl_ioty_timeout(gpointer user_data)
                        return G_SOURCE_REMOVE;
                }
        }
-
+       DBG("Call the callback done");
        ret = icl_ioty_mutex_lock();
        if (IOTCON_ERROR_NONE != ret) {
                ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
@@ -327,6 +328,7 @@ static gboolean _icl_ioty_timeout(gpointer user_data)
                return G_SOURCE_REMOVE;
        }
 
+       FN_END;
        return G_SOURCE_REMOVE;
 }
 /* LCOV_EXCL_STOP */
@@ -1349,6 +1351,7 @@ static void _icl_ioty_encap_get_cb(iotcon_remote_resource_h resource,
                iotcon_response_h response,
                void *user_data)
 {
+       FN_CALL;
        int ret;
        iotcon_representation_h repr;
        iotcon_remote_resource_state_e state;
@@ -1368,8 +1371,10 @@ static void _icl_ioty_encap_get_cb(iotcon_remote_resource_h resource,
                }
 
                if (state != resource->monitoring.state) {
+                       DBG("call the callback...");
                        resource->monitoring.cb(resource, state, resource->monitoring.user_data);
                        resource->monitoring.state = state;
+                       DBG("call the callback done");
                }
        }
 
@@ -1392,8 +1397,11 @@ static void _icl_ioty_encap_get_cb(iotcon_remote_resource_h resource,
                        if (response)
                                response->repr = NULL;
 
-                       if (resource->caching.cb)
+                       if (resource->caching.cb) {
+                               DBG("call the callback...");
                                resource->caching.cb(resource, repr, resource->caching.user_data);
+                               DBG("call the callback done");
+                       }
                }
        }
 }
@@ -1551,6 +1559,8 @@ int icl_ioty_remote_resource_start_caching(iotcon_remote_resource_h resource,
        if (resource->monitoring.presence)
                return IOTCON_ERROR_NONE;
 
+       DBG("checking_interval:[%d]", resource->checking_interval);
+
        ret = icl_ioty_remote_resource_set_checking_interval(resource,
                        resource->checking_interval);
        if (IOTCON_ERROR_NONE != ret) {
@@ -1735,6 +1745,7 @@ int icl_ioty_resource_create(const char *uri_path,
        }
 
        *resource_handle = resource;
+       DBG("resource:[%p]", resource);
 
        return IOTCON_ERROR_NONE;
 }
index b1fbd55..ca22303 100644 (file)
--- a/src/ic.c
+++ b/src/ic.c
@@ -24,6 +24,8 @@
 #define ICL_TIMEOUT_DEFAULT 30 /* 30 sec */
 #define ICL_DEFAULT_DEVICE_NAME "UNKNOWN"
 
+#define ICL_POLLING_INTERVAL_MAX 999 /* 999 ms */
+
 #define ICL_IOTY_TIME_INTERVAL_DEFAULT 100 /* 100 ms */
 
 static pthread_t icl_thread;
@@ -128,6 +130,8 @@ int icl_polling_get_interval(int *interval)
 int icl_polling_set_interval(int interval)
 {
        RETV_IF(interval <= 0, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(interval > ICL_POLLING_INTERVAL_MAX, IOTCON_ERROR_INVALID_PARAMETER);
+
        INFO("interval [%d]", interval);
 
        icl_ioty_polling_interval = interval;