Fix an issue where the log option is applied incorrectly
[platform/upstream/connman.git] / src / wispr.c
index c3b0c9c..62f6b8d 100755 (executable)
@@ -422,6 +422,10 @@ static void wispr_portal_error(struct connman_wispr_portal_context *wp_context)
        DBG("Failed to proceed wispr/portal web request");
 
        wp_context->wispr_result = CONNMAN_WISPR_RESULT_FAILED;
+
+#if defined TIZEN_EXT
+       connman_service_set_internet_connection(wp_context->service, false);
+#endif
 }
 
 static void portal_manage_status(GWebResult *result,
@@ -568,7 +572,7 @@ static void wispr_portal_browser_reply_cb(struct connman_service *service,
        }
 
        /* Restarting the test */
-       __connman_wispr_start(service, wp_context->type);
+       __connman_service_wispr_start(service, wp_context->type);
 }
 
 static void wispr_portal_request_wispr_login(struct connman_service *service,
@@ -688,6 +692,9 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
        const char *str = NULL;
        guint16 status;
        gsize length;
+#if defined TIZEN_MAINTAIN_ONLINE
+       static int retried = 0;
+#endif
 
        DBG("");
 
@@ -719,6 +726,9 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
                                wp_context->status_url, wp_context);
                break;
        case 200:
+#if defined TIZEN_MAINTAIN_ONLINE
+               retried = 0;
+#endif
                if (wp_context->wispr_msg.message_type >= 0)
                        break;
 
@@ -756,6 +766,19 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
        case 404:
                if (__connman_service_online_check_failed(wp_context->service,
                                                wp_context->type) == 0) {
+#if defined TIZEN_MAINTAIN_ONLINE
+                       if (wp_context->type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+                               if (retried == 0) {
+                                       connman_agent_report_error(wp_context->service,
+                                               __connman_service_get_path(wp_context->service),
+                                               "internet-unreachable",
+                                               NULL, NULL, NULL);
+
+                                       retried = 1;
+                               }
+                               break;
+                       }
+#endif
                        wispr_portal_error(wp_context);
                        free_connman_wispr_portal_context(wp_context);
                        return false;
@@ -832,8 +855,8 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
        int err = 0;
        int i;
 
-       DBG("wispr/portal context %p", wp_context);
-       DBG("service %p", wp_context->service);
+       DBG("wispr/portal context %p service %p", wp_context,
+               wp_context->service);
 
        service_type = connman_service_get_type(wp_context->service);
 
@@ -849,6 +872,9 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_VPN:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                return -EOPNOTSUPP;
        }
 
@@ -908,8 +934,7 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
                        free_connman_wispr_portal_context(wp_context);
                }
        } else if (wp_context->timeout == 0) {
-               wp_context->timeout =
-                       g_timeout_add_seconds(0, no_proxy_callback, wp_context);
+               wp_context->timeout = g_idle_add(no_proxy_callback, wp_context);
        }
 
 done: