Enable the TTL for Standalone Provider
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 9 Apr 2015 09:11:25 +0000 (18:11 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 9 Apr 2015 09:11:25 +0000 (18:11 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I48b794b1678ad41e6ec8b1208de56bedb5f12712

include/slave_life.h
src/package.c
src/slave_life.c

index eeef228..5e55a9f 100644 (file)
@@ -151,6 +151,7 @@ extern struct slave_node *slave_find_by_rpc_handle(int handle);
 
 extern void slave_dead_handler(struct slave_node *slave);
 extern const int const slave_is_secured(const struct slave_node *slave);
+extern const int const slave_is_app(const struct slave_node *slave);
 extern const char * const slave_name(const struct slave_node *slave);
 extern const pid_t const slave_pid(const struct slave_node *slave);
 extern const char * const slave_abi(const struct slave_node *slave);
index 212e618..314849d 100644 (file)
@@ -684,6 +684,7 @@ static int package_is_faulted(struct pkg_info *info, double timestamp)
                return 1;
        }
 
+       DbgPrint("Faulted: %d (%d / %lf)\n", info->fault_count, WIDGET_CONF_FAULT_DETECT_COUNT, WIDGET_CONF_FAULT_DETECT_IN_TIME);
        return 0;
 }
 
@@ -704,6 +705,7 @@ HAPI int package_set_fault_info(struct pkg_info *info, double timestamp, const c
        struct fault_info *fault;
 
        if (!package_is_faulted(info, timestamp)) {
+               DbgPrint("Faulted but excused\n");
                return WIDGET_ERROR_CANCELED;
        }
 
@@ -1516,12 +1518,15 @@ HAPI int package_fini(void)
        return 0;
 }
 
+/**
+ * Find a standalone provider
+ */
 HAPI const char *package_find_by_secured_slave(struct slave_node *slave)
 {
        Eina_List *l;
        struct pkg_info *info;
 
-       if (!slave_is_secured(slave)) {
+       if (!slave_is_secured(slave) && !slave_is_app(slave)) {
                return NULL;
        }
 
index f959079..446e150 100644 (file)
@@ -453,7 +453,7 @@ HAPI int slave_expired_ttl(struct slave_node *slave)
                return 0;
        }
 
-       if (!slave->secured && !(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) {
+       if (!slave_is_app(slave) && !slave->secured && !(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) {
                return 0;
        }
 
@@ -832,7 +832,7 @@ HAPI int slave_give_more_ttl(struct slave_node *slave)
 {
        double delay;
 
-       if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) && (!slave->secured || !slave->ttl_timer)) {
+       if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer)) {
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
@@ -843,7 +843,7 @@ HAPI int slave_give_more_ttl(struct slave_node *slave)
 
 HAPI int slave_freeze_ttl(struct slave_node *slave)
 {
-       if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) && (!slave->secured || !slave->ttl_timer)) {
+       if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer)) {
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
@@ -855,7 +855,7 @@ HAPI int slave_thaw_ttl(struct slave_node *slave)
 {
        double delay;
 
-       if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) && (!slave->secured || !slave->ttl_timer)) {
+       if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer)) {
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
@@ -875,7 +875,7 @@ HAPI int slave_activated(struct slave_node *slave)
         * 1. If the slave is INHOUSE(data-provider-slave) and LIMIT_TO_TTL is true, and SLAVE_TTL is greater than 0.0f
         * 2. Service provider is "secured" and SLAVE_TTL is greater than 0.0f
         */
-       if (((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured == 1) && WIDGET_CONF_SLAVE_TTL > 0.0f) {
+       if (((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured == 1 || slave_is_app(slave)) && WIDGET_CONF_SLAVE_TTL > 0.0f) {
                DbgPrint("Slave deactivation timer is added (%s - %lf)\n", slave_name(slave), WIDGET_CONF_SLAVE_TTL);
                slave->ttl_timer = ecore_timer_add(WIDGET_CONF_SLAVE_TTL, slave_ttl_cb, slave);
                if (!slave->ttl_timer) {
@@ -1560,6 +1560,11 @@ HAPI const int const slave_is_secured(const struct slave_node *slave)
        return slave->secured;
 }
 
+HAPI const int const slave_is_app(const struct slave_node *slave)
+{
+       return !strcasecmp(slave_abi(slave), WIDGET_CONF_APP_ABI);
+}
+
 HAPI const char * const slave_name(const struct slave_node *slave)
 {
        return slave->name;