Try to detect portal even if the location driver is already set
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 8 Sep 2010 14:42:18 +0000 (16:42 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 8 Sep 2010 14:48:02 +0000 (16:48 +0200)
With DHCP renewals the ConnMan state can go from Online to Ready and a
location detect will start. Since the location driver is already set by
then, this will fail and ConnMan's state will be stuck at Ready. Instead
of returning an error, the location finish() hooks is called and a new
portal detection is triggered.

src/location.c

index aee2ea1..6ea8b3e 100644 (file)
@@ -225,8 +225,15 @@ int __connman_location_detect(struct connman_service *service)
        if (location == NULL)
                return -EINVAL;
 
-       if (location->driver)
-               return -EBUSY;
+       if (location->driver) {
+               location->result = CONNMAN_LOCATION_RESULT_UNKNOWN;
+               location->driver->finish(location);
+
+               if (location->driver->detect(location) == 0)
+                       return 0;
+
+               location->driver = NULL;
+       }
 
        for (list = driver_list; list; list = list->next) {
                struct connman_location_driver *driver = list->data;