device: Remove connections counter
authorDanny Jeongseok Seo <s.seo@samsung.com>
Thu, 6 Oct 2011 03:59:29 +0000 (12:59 +0900)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 6 Oct 2011 09:48:00 +0000 (11:48 +0200)
The device connection counter is only used by the post scan auto connection
logic, and the connection status is handled by the autoconnection service
routine itself (__connman_service_auto_connect()).

src/connman.h
src/device.c
src/network.c

index 79025a8..ba161d3 100644 (file)
@@ -343,9 +343,6 @@ int __connman_device_get_phyindex(struct connman_device *device);
 void __connman_device_set_phyindex(struct connman_device *device,
                                                        int phyindex);
 
-void __connman_device_increase_connections(struct connman_device *device);
-void __connman_device_decrease_connections(struct connman_device *device);
-
 void __connman_device_set_network(struct connman_device *device,
                                        struct connman_network *network);
 void __connman_device_cleanup_networks(struct connman_device *device);
index b830688..de7b141 100644 (file)
@@ -58,7 +58,6 @@ struct connman_device {
        char *devname;
        int phyindex;
        int index;
-       unsigned int connections;
        guint scan_timeout;
        guint pending_timeout;
 
@@ -678,10 +677,8 @@ int connman_device_set_powered(struct connman_device *device,
        else
                __connman_technology_disabled(type);
 
-       if (powered == FALSE) {
-               device->connections = 0;
+       if (powered == FALSE)
                return 0;
-       }
 
        connman_device_set_disconnected(device, FALSE);
        device->scanning = FALSE;
@@ -852,7 +849,10 @@ int connman_device_set_disconnected(struct connman_device *device,
        device->disconnected = disconnected;
 
        if (disconnected == TRUE)
+       {
                force_scan_trigger(device);
+               device->backoff_interval = SCAN_INITIAL_DELAY;
+       }
 
        return 0;
 }
@@ -926,25 +926,6 @@ const char *connman_device_get_string(struct connman_device *device,
        return NULL;
 }
 
-void __connman_device_increase_connections(struct connman_device *device)
-{
-       if (device == NULL)
-               return;
-
-       device->connections++;
-}
-
-void __connman_device_decrease_connections(struct connman_device *device)
-{
-       if (device == NULL)
-               return;
-
-       device->connections--;
-
-       if (device->connections == 0)
-               device->backoff_interval = SCAN_INITIAL_DELAY;
-}
-
 /**
  * connman_device_add_network:
  * @device: device structure
index ffbf220..50d0492 100644 (file)
@@ -779,8 +779,6 @@ static void set_configuration(struct connman_network *network)
 
        DBG("network %p", network);
 
-       __connman_device_increase_connections(network->device);
-
        __connman_device_set_network(network->device, network);
 
        connman_device_set_disconnected(network->device, FALSE);
@@ -963,8 +961,6 @@ static int manual_ipv6_set(struct connman_network *network,
        __connman_connection_gateway_activate(service,
                                                CONNMAN_IPCONFIG_TYPE_IPV6);
 
-       __connman_device_increase_connections(network->device);
-
        __connman_device_set_network(network->device, network);
 
        connman_device_set_disconnected(network->device, FALSE);
@@ -978,8 +974,6 @@ static void autoconf_ipv6_set(struct connman_network *network)
 {
        DBG("network %p", network);
 
-       __connman_device_increase_connections(network->device);
-
        __connman_device_set_network(network->device, network);
 
        connman_device_set_disconnected(network->device, FALSE);
@@ -1152,9 +1146,6 @@ int connman_network_set_connected(struct connman_network *network,
        if (network->connected == connected)
                return -EALREADY;
 
-       if (connected == FALSE)
-               __connman_device_decrease_connections(network->device);
-
        network->connected = connected;
 
        set_connected(network);