summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurav Babu <saurav.babu@samsung.com>2016-07-07 14:22:45 (GMT)
committerSaurav Babu <saurav.babu@samsung.com>2016-07-07 14:22:45 (GMT)
commitffac4f3e6667d2b6e1cda87303d6fdd9f2de6256 (patch)
tree86685e834db98d14f6a74a5fbdc698c8b73667df
parent0a714ce6194d231e509310aa69a230e7e5914853 (diff)
downloadconnman-ffac4f3e6667d2b6e1cda87303d6fdd9f2de6256.zip
connman-ffac4f3e6667d2b6e1cda87303d6fdd9f2de6256.tar.gz
connman-ffac4f3e6667d2b6e1cda87303d6fdd9f2de6256.tar.bz2
Upstream: network: Replace network_change() with __connman_network_disconnect()refs/changes/85/78985/1
The network_change() function called when a network error is set will disconnect a network driver identical to __connman_network_disconnect() but without any error handling. Therefore the specific network_change() function is better replaced with __connman_network_disconnect(). With connman_network_set_error() now calling __connman_network_disconnect(), the additional function call can now be removed from connman_network_set_connected(). Also let the associating and connecting variables be handled by the normal code paths and don't forcefully unset them when an error happens. Commit ID: 7a3740c4c65be7915c36daaac9b1a611fa498a2 Change-Id: I3223a9d13207898aa64e2002912516d5ad64c150 Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rwxr-xr-xsrc/network.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/network.c b/src/network.c
index d20385f..491515f 100755
--- a/src/network.c
+++ b/src/network.c
@@ -847,23 +847,6 @@ static void network_remove(struct connman_network *network)
network->driver = NULL;
}
-static void network_change(struct connman_network *network)
-{
- DBG("network %p name %s", network, network->name);
-
- if (!network->connected)
- return;
-
- connman_device_set_disconnected(network->device, true);
-
- if (network->driver && network->driver->disconnect) {
- network->driver->disconnect(network);
- return;
- }
-
- network->connected = false;
-}
-
static void probe_driver(struct connman_network_driver *driver)
{
GSList *list;
@@ -1470,9 +1453,6 @@ void connman_network_set_error(struct connman_network *network,
{
DBG("network %p error %d", network, error);
- network->connecting = false;
- network->associating = false;
-
switch (error) {
case CONNMAN_NETWORK_ERROR_UNKNOWN:
return;
@@ -1495,7 +1475,7 @@ void connman_network_set_error(struct connman_network *network,
#endif
}
- network_change(network);
+ __connman_network_disconnect(network);
}
/**
@@ -1516,8 +1496,7 @@ int connman_network_set_connected(struct connman_network *network,
!connected) {
connman_network_set_error(network,
CONNMAN_NETWORK_ERROR_CONNECT_FAIL);
- if (__connman_network_disconnect(network) == 0)
- return 0;
+ return 0;
}
if (network->connected == connected)