X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmonitor%2Fstc-monitor-rstn.c;h=31a05abbe4226663c32d081279ecfe18bf3f4a2c;hb=f2380cadc63c01f6dee9780e7f3ab6ce19ee8faa;hp=ce3fa63905b6c5db971ec514989639c3688927a9;hpb=42a1fa7181ee6aaa9ad5b448ee29713694c4c6e0;p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git diff --git a/src/monitor/stc-monitor-rstn.c b/src/monitor/stc-monitor-rstn.c old mode 100644 new mode 100755 index ce3fa63..31a05ab --- a/src/monitor/stc-monitor-rstn.c +++ b/src/monitor/stc-monitor-rstn.c @@ -212,6 +212,9 @@ static void __rstn_add_ipt_rule(int64_t classid, nfacct_rule_intend intend, for (; conn_list != NULL; conn_list = conn_list->next) { stc_connection_s *conn = conn_list->data; + if (conn == NULL) + return; + if (!stc->carg) { stc->carg = MALLOC0(counter_arg_s, 1); if (stc->carg == NULL) @@ -258,6 +261,9 @@ static void __rstn_del_ipt_rule(int64_t classid, nfacct_rule_intend intend, for (; conn_list != NULL; conn_list = conn_list->next) { stc_connection_s *conn = conn_list->data; + if (conn == NULL) + return; + if (!stc->carg) { stc->carg = MALLOC0(counter_arg_s, 1); if (stc->carg == NULL) @@ -551,7 +557,7 @@ static void __rstn_process(enum traffic_restriction_type rstn_type, rstn_data->counter[STC_RSTN_LIMIT_TYPE_WEEKLY] = info.weekly_counter + stat.weekly_stat; rstn_data->counter[STC_RSTN_LIMIT_TYPE_DAILY] = info.daily_counter + stat.daily_stat; - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGD("Rstn counter data[%lld] warn[%lld] " "monthly[%lld] weekly[%lld] daily[%lld]", rstn_data->counter[STC_RSTN_LIMIT_TYPE_DATA], @@ -585,7 +591,7 @@ static void __rstn_process(enum traffic_restriction_type rstn_type, rstn_data->rstn_state = STC_RSTN_STATE_ACTIVATED; - if (STC_DEBUG_LOG) { + if (STC_DEBUG_LOG && STC_RSTN_LOG) { STC_LOGD("Restriction activated " "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]", rstn_data->classid, rstn_data->restriction_id); @@ -600,7 +606,7 @@ static void __rstn_process(enum traffic_restriction_type rstn_type, rstn_data->limit_exceeded = 0; rstn_data->limit_notified = 0; - if (STC_DEBUG_LOG) { + if (STC_DEBUG_LOG && STC_RSTN_LOG) { STC_LOGD("Restriction activated " "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]", rstn_data->classid, rstn_data->restriction_id); @@ -627,7 +633,7 @@ static void __rstn_process(enum traffic_restriction_type rstn_type, __rstn_set_noti_state(STC_RSTN_STATE_UNSET); - if (STC_DEBUG_LOG) { + if (STC_DEBUG_LOG && STC_RSTN_LOG) { STC_LOGD("Restriction deactivated " "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]", rstn_data->classid, rstn_data->restriction_id); @@ -645,7 +651,7 @@ static void __rstn_add(gpointer data, gpointer user_data) /* rstn rule is activated */ if (rstn_data->rstn_state == STC_RSTN_STATE_ACTIVATED) { - if (STC_DEBUG_LOG) { + if (STC_DEBUG_LOG && STC_RSTN_LOG) { STC_LOGD("Restriction already activated " "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]", rstn_data->classid, rstn_data->restriction_id); @@ -665,7 +671,7 @@ static void __rstn_add(gpointer data, gpointer user_data) rstn_data->app_id, rstn_data, user_data); } - if (STC_DEBUG_LOG) { + if (STC_DEBUG_LOG && STC_RSTN_LOG) { __print_rstn(rstn_data); STC_LOGD("\033[1;32mRestriction added\033[0;m " "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]", @@ -697,7 +703,7 @@ static void __rstn_remove(gpointer data, gpointer user_data) __rstn_tethering_process(RST_UNSET, rstn_data->app_id, rstn_data, user_data); - if (STC_DEBUG_LOG) { + if (STC_DEBUG_LOG && STC_RSTN_LOG) { __print_rstn(rstn_data); STC_LOGD("\033[1;31mRestriction removed\033[0;m " "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]", @@ -776,7 +782,7 @@ static stc_error_e __rstn_data_remove(stc_rstn_data_s *data) lookup_value = g_hash_table_lookup(rstns, GUINT_TO_POINTER(data->classid)); if (!lookup_value) { - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGE("Restriction not found [\033[1;36m%d\033[0;m]", data->classid); return STC_ERROR_NO_DATA; @@ -785,7 +791,7 @@ static stc_error_e __rstn_data_remove(stc_rstn_data_s *data) lookup_list = g_slist_find_custom(lookup_value->rules, data, __rstn_data_comp); if (!lookup_list) { - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGE("Restriction not found [%d:%s:%s:%d]", data->iftype, data->ifname, data->subscriber_id, data->roaming); @@ -821,7 +827,7 @@ static stc_error_e __rstn_data_add(stc_rstn_data_s *data) rstn_data = MALLOC0(stc_rstn_data_s, 1); if (!rstn_data) { - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGE("Rstn_data allocation failed"); return STC_ERROR_OUT_OF_MEMORY; } @@ -830,7 +836,7 @@ static stc_error_e __rstn_data_add(stc_rstn_data_s *data) if (!lookup_value) { rstn_value = MALLOC0(stc_rstn_value_s, 1); if (!rstn_value) { - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGE("Rstn_value allocation failed"); FREE(rstn_data); return STC_ERROR_OUT_OF_MEMORY; @@ -1297,7 +1303,7 @@ void stc_monitor_rstn_action_when_limit_exceeded(stc_rstn_limit_type_e limit_typ stc_plugin_appstatus_send_message(net_popup_content, net_popup_type, rstn_data->app_id, iftype, byte); - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGD("Limit exceeded [\033[0;31m%s\033[0;m:%d]", net_popup_content, limit_type); } @@ -1375,7 +1381,7 @@ void stc_monitor_rstn_add_for_app(uint32_t classid) lookup_value = g_hash_table_lookup(rstns, GUINT_TO_POINTER(classid)); if (!lookup_value) { - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGD("Restriction not found [\033[1;36m%d\033[0;m]", classid); return; @@ -1426,7 +1432,7 @@ void stc_monitor_rstn_remove_for_app(uint32_t classid) lookup_value = g_hash_table_lookup(rstns, GUINT_TO_POINTER(classid)); if (!lookup_value) { - if (STC_DEBUG_LOG) + if (STC_DEBUG_LOG && STC_RSTN_LOG) STC_LOGD("Restriction not found [\033[1;36m%d\033[0;m]", classid); return;