Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH 2/2] service: retry online check permanently until
      success (Julien Massot)


----------------------------------------------------------------------

Message: 1
Date: Wed,  6 Mar 2019 16:47:37 +0100
From: Julien Massot <[email protected]>
To: [email protected]
Subject: [PATCH 2/2] service: retry online check permanently until
        success
Message-ID: <[email protected]>

From: Julien Massot <[email protected]>

This make online check happen right after ready state, and
then after ONLINE_CHECK_INITIAL_INTERVAL (1 second) like before,
and then happen after + ONLINE_CHECK_INCREMENT_INTERVAL until
reaching the maximum interval ONLINE_CHECK_MAX_INTERVAL.

Once we reached the ready state we stop online check.
---
 src/service.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/src/service.c b/src/service.c
index 6044c601..eca098d7 100644
--- a/src/service.c
+++ b/src/service.c
@@ -128,8 +128,8 @@ struct connman_service {
        bool wps;
        bool wps_advertizing;
        guint online_timeout;
-       int online_check_count_ipv4;
-       int online_check_count_ipv6;
+       int online_check_interval_ipv4;
+       int online_check_interval_ipv6;
        bool do_split_routing;
        bool new_service;
        bool hidden_service;
@@ -3426,15 +3426,25 @@ int __connman_service_reset_ipconfig(struct 
connman_service *service,
        return err;
 }
 
+/*
+ * We set the timeout to 1 sec so that we have a chance to get
+ * necessary IPv6 router advertisement messages that might have
+ * DNS data etc.
+ */
+#define ONLINE_CHECK_INITIAL_INTERVAL 1
+
+#define ONLINE_CHECK_INCREMENT_INTERVAL 30
+#define ONLINE_CHECK_MAX_INTERVAL 300
+
 void __connman_service_wispr_start(struct connman_service *service,
                                        enum connman_ipconfig_type type)
 {
        DBG("service %p type %s", service, 
__connman_ipconfig_type2string(type));
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
-               service->online_check_count_ipv4 = 1;
+               service->online_check_interval_ipv4 = 
ONLINE_CHECK_INITIAL_INTERVAL;
        else
-               service->online_check_count_ipv6 = 1;
+               service->online_check_interval_ipv6 = 
ONLINE_CHECK_INITIAL_INTERVAL;
 
        __connman_wispr_start(service, type);
 }
@@ -6031,36 +6041,40 @@ int __connman_service_online_check_failed(struct 
connman_service *service,
                                        enum connman_ipconfig_type type)
 {
        GSourceFunc redo_func;
-       int *count;
+       int *interval;
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
-               count = &service->online_check_count_ipv4;
+               interval = &service->online_check_interval_ipv4;
                redo_func = redo_wispr_ipv4;
        } else {
-               count = &service->online_check_count_ipv6;
+               interval = &service->online_check_interval_ipv6;
                redo_func = redo_wispr_ipv6;
        }
 
-       DBG("service %p type %s count %d", service,
-               __connman_ipconfig_type2string(type), *count);
+       DBG("service %p type %s interval %d", service,
+               __connman_ipconfig_type2string(type), *interval);
 
-       if (*count == 0) {
+       if (*interval == ONLINE_CHECK_INITIAL_INTERVAL) {
                connman_warn("%s online check failed for %p %s",
                        __connman_ipconfig_type2string(type),
                        service, service->name);
-               return 0;
        }
 
-       *count -= 1;
-
        /*
         * We set the timeout to 1 sec so that we have a chance to get
         * necessary IPv6 router advertisement messages that might have
         * DNS data etc.
         */
-       service->online_timeout = g_timeout_add_seconds(1, redo_func,
+       service->online_timeout = g_timeout_add_seconds(*interval, redo_func,
                                        connman_service_ref(service));
 
+       if (*interval + ONLINE_CHECK_INCREMENT_INTERVAL >
+                                       ONLINE_CHECK_MAX_INTERVAL)
+               *interval = ONLINE_CHECK_MAX_INTERVAL;
+       else
+               *interval += ONLINE_CHECK_INCREMENT_INTERVAL;
+
+
        return EAGAIN;
 }
 
-- 
2.20.1



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 41, Issue 7
**************************************

Reply via email to