summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2016-06-15 21:13:53 +0530
committerNiraj Kumar Goit <niraj.g@samsung.com>2016-06-17 03:34:10 -0700
commit834326ac086f2c94dec541a10707da61fc6db991 (patch)
treecdc138c85b535a1ad1cb6222534f7d377cba9678
parent038d71d7e27da9e3722dd4518af253168197ebca (diff)
downloadconnman-834326ac086f2c94dec541a10707da61fc6db991.tar.gz
connman-834326ac086f2c94dec541a10707da61fc6db991.tar.bz2
connman-834326ac086f2c94dec541a10707da61fc6db991.zip
[SPIN] Fix wireless issues in connman.
desc: Set connection error when AP is removed. Change ASSOC_RETRY_COUNT(3 -> 4). send the scan request after connecting - check the ap availability fix the too much scan in associating Change-Id: Ia1d0367a2f792f6c2f92a6ef498b37511840135d Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-xinclude/network.h3
-rwxr-xr-xplugins/wifi.c57
-rwxr-xr-xsrc/network.c9
3 files changed, 36 insertions, 33 deletions
diff --git a/include/network.h b/include/network.h
index 4b852b52..91abe515 100755
--- a/include/network.h
+++ b/include/network.h
@@ -92,6 +92,9 @@ void connman_network_set_group(struct connman_network *network,
const char *connman_network_get_group(struct connman_network *network);
bool connman_network_get_connecting(struct connman_network *network);
+#if defined TIZEN_EXT
+void connman_network_set_connecting(struct connman_network *network);
+#endif
int connman_network_set_available(struct connman_network *network,
bool available);
bool connman_network_get_available(struct connman_network *network);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 632e138e..b4abd21d 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -130,7 +130,6 @@ struct wifi_data {
int servicing;
#if defined TIZEN_EXT
int assoc_retry_count;
- struct connman_network *interface_disconnected_network;
struct connman_network *scan_pending_network;
#endif
};
@@ -138,7 +137,7 @@ struct wifi_data {
#if defined TIZEN_EXT
#include "connman.h"
-#define TIZEN_ASSOC_RETRY_COUNT 3
+#define TIZEN_ASSOC_RETRY_COUNT 4
static gboolean wifi_first_scan = false;
static gboolean found_with_first_scan = false;
@@ -1320,9 +1319,10 @@ static void scan_callback(int result, GSupplicantInterface *interface,
connman_device_unref(device);
#if defined TIZEN_EXT
- if (wifi && wifi->scan_pending_network) {
+ if (wifi && wifi->scan_pending_network && result != -EIO) {
network_connect(wifi->scan_pending_network);
wifi->scan_pending_network = NULL;
+ connman_network_set_connecting(wifi->network);
}
if (is_wifi_notifier_registered != true &&
@@ -1589,7 +1589,6 @@ static int wifi_disable(struct connman_device *device)
#if defined TIZEN_EXT
wifi->scan_pending_network = NULL;
- wifi->interface_disconnected_network = NULL;
if (is_wifi_notifier_registered == true) {
connman_notifier_unregister(&notifier);
@@ -2048,9 +2047,6 @@ static void network_remove(struct connman_network *network)
if (wifi->scan_pending_network == network)
wifi->scan_pending_network = NULL;
-
- if (wifi->interface_disconnected_network == network)
- wifi->interface_disconnected_network = NULL;
#endif
}
@@ -2077,7 +2073,6 @@ static void connect_callback(int result, GSupplicantInterface *interface,
return;
found:
- wifi->interface_disconnected_network = NULL;
#endif
if (result == -ENOKEY) {
connman_network_set_error(network,
@@ -2193,20 +2188,6 @@ static int network_connect(struct connman_network *network)
ssid_init(ssid, network);
-#if defined TIZEN_EXT
- if (wifi->interface_disconnected_network == network) {
- g_free(ssid);
- throw_wifi_scan(device, scan_callback);
-
- if (wifi->disconnecting != TRUE) {
- wifi->scan_pending_network = network;
- wifi->interface_disconnected_network = NULL;
- }
-
- return -EINPROGRESS;
- }
-#endif
-
if (wifi->disconnecting) {
wifi->pending_network = network;
g_free(ssid);
@@ -2214,7 +2195,6 @@ static int network_connect(struct connman_network *network)
wifi->network = connman_network_ref(network);
wifi->retries = 0;
#if defined TIZEN_EXT
- wifi->interface_disconnected_network = NULL;
wifi->scan_pending_network = NULL;
#endif
@@ -2322,8 +2302,6 @@ static int network_disconnect(struct connman_network *network)
if (wifi->scan_pending_network == network)
wifi->scan_pending_network = NULL;
- if (wifi->interface_disconnected_network == network)
- wifi->interface_disconnected_network = NULL;
#endif
connman_network_set_associating(network, false);
@@ -2632,6 +2610,8 @@ static void interface_state(GSupplicantInterface *interface)
reset_autoscan(device);
wifi->assoc_retry_count = 0;
+
+ wifi->scan_pending_network = NULL;
#else
/* though it should be already stopped: */
stop_autoscan(device);
@@ -2704,11 +2684,6 @@ static void interface_state(GSupplicantInterface *interface)
if (err < 0)
wifi->disconnecting = false;
- if (wifi->connected)
- wifi->interface_disconnected_network = wifi->network;
- else
- wifi->interface_disconnected_network = NULL;
-
connman_network_set_connected(network, false);
connman_network_set_associating(network, false);
@@ -2865,6 +2840,8 @@ static void scan_finished(GSupplicantInterface *interface)
{
#if defined TIZEN_EXT
struct wifi_data *wifi;
+ bool is_associating = false;
+ static bool is_scanning = true;
#endif
DBG("");
@@ -2875,6 +2852,23 @@ static void scan_finished(GSupplicantInterface *interface)
network_connect(wifi->scan_pending_network);
wifi->scan_pending_network = NULL;
}
+
+ //service state - associating
+ if(!wifi || !wifi->network)
+ return;
+
+ is_associating = connman_network_get_associating(wifi->network);
+ if(is_associating && is_scanning){
+ is_scanning = false;
+ DBG("send scan for connecting");
+ throw_wifi_scan(wifi->device, scan_callback);
+
+ return;
+ }
+ is_scanning = true;
+
+ //go scan
+
#endif
}
@@ -3036,9 +3030,6 @@ static void network_removed(GSupplicantNetwork *network)
if (connman_network == wifi->scan_pending_network)
wifi->scan_pending_network = NULL;
- if (connman_network == wifi->interface_disconnected_network)
- wifi->interface_disconnected_network = NULL;
-
if (connman_network == wifi->pending_network)
wifi->pending_network = NULL;
diff --git a/src/network.c b/src/network.c
index 57a1db39..610c1369 100755
--- a/src/network.c
+++ b/src/network.c
@@ -1204,6 +1204,15 @@ bool __connman_network_get_weakness(struct connman_network *network)
return false;
}
+#if defined TIZEN_EXT
+void connman_network_set_connecting(struct connman_network *network)
+{
+ DBG("set network connecting true");
+ network->connecting = TRUE;
+ return;
+}
+#endif
+
bool connman_network_get_connecting(struct connman_network *network)
{
return network->connecting;