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 v4 2/4] service: implement AlwaysConnectedTechnologies
option (Ioan-Adrian Ratiu)
2. [PATCH v4 4/4] main.conf: document
AlwaysConnectedTechnologies option (Ioan-Adrian Ratiu)
3. [PATCH v4 3/4] service: abstract the more complex autoconnect
conditionals (Ioan-Adrian Ratiu)
----------------------------------------------------------------------
Message: 1
Date: Fri, 11 Nov 2016 17:53:17 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Subject: [PATCH v4 2/4] service: implement AlwaysConnectedTechnologies
option
Message-ID: <[email protected]>
Content-Type: text/plain
Add a new function always_connect which returns true if a service type
is in the list of technologies to always autoconnect. Call it at various
points in the auto_connect_service function to ensure the service type
always connects regardless of any preffered technologies settings and
correctly handles session logic.
---
src/service.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/service.c b/src/service.c
index f6a76f6..e86718a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3750,6 +3750,19 @@ static GList *preferred_tech_list_get(void)
return tech_data.preferred_list;
}
+static bool always_connect(enum connman_service_type type)
+{
+ unsigned int *always_connected_techs =
+ connman_setting_get_uint_list("AlwaysConnectedTechnologies");
+ int i;
+
+ for (i = 0; always_connected_techs && always_connected_techs[i]; i++)
+ if (always_connected_techs[i] == type)
+ return true;
+
+ return false;
+}
+
static bool auto_connect_service(GList *services,
enum connman_service_connect_reason reason,
bool preferred)
@@ -3776,8 +3789,8 @@ static bool auto_connect_service(GList *services,
if (service->pending ||
is_connecting(service) ||
is_connected(service)) {
- if (!active_count)
- return true;
+ if (!active_count && !always_connect(service->type))
+ return true;
ignore[service->type] = true;
autoconnecting = true;
@@ -3799,7 +3812,9 @@ static bool auto_connect_service(GList *services,
CONNMAN_SERVICE_STATE_IDLE)
continue;
- if (autoconnecting && !active_sessions[service->type]) {
+ if (autoconnecting &&
+ !active_sessions[service->type] &&
+ !always_connect(service->type)) {
DBG("service %p type %s has no users", service,
__connman_service_type2string(service->type));
continue;
@@ -3810,7 +3825,7 @@ static bool auto_connect_service(GList *services,
__connman_service_connect(service, reason);
- if (!active_count)
+ if (!active_count && !always_connect(service->type))
return true;
ignore[service->type] = true;
--
2.10.2
------------------------------
Message: 2
Date: Fri, 11 Nov 2016 17:53:19 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Subject: [PATCH v4 4/4] main.conf: document
AlwaysConnectedTechnologies option
Message-ID: <[email protected]>
Content-Type: text/plain
By default it's disabled and the list is empty.
Also document the man page for this main.conf option.
---
doc/connman.conf.5.in | 6 ++++++
src/main.conf | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index ff97b7c..db9e558 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -67,6 +67,12 @@ for this entry when empty is ethernet,wifi,cellular.
Services that are automatically connected must have been
set up and saved to storage beforehand.
.TP
+.BI AlwaysConnectedTechnologies= technology\fR[,...]
+List of technoolgies which are always connected regardless
+of PreferredTechnologies setting (AutoConnect = true). The
+default value is empty and this feature is disabled unless
+explicitely enabled in the config file.
+.TP
.BI PreferredTechnologies= technology\fR[,...]
List of preferred technologies from the most preferred
one to the least preferred one separated by commas ",".
diff --git a/src/main.conf b/src/main.conf
index acceda3..d619413 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -101,3 +101,10 @@
# quality. See RFC6343. Default value is false (as recommended by RFC6343
# section 4.1).
# Enable6to4 = false
+
+# List of technologies with AutoConnect = true which are always connected
+# regardless of PreferredTechnologies setting. Default value is empty and
+# will connect a technology only if it is at a higher preference than any
+# other which is already connected.
+# This setting has no effect if SingleConnectedTechnologies is enabled.
+# AlwaysConnectedTechnologies =
--
2.10.2
------------------------------
Message: 3
Date: Fri, 11 Nov 2016 17:53:18 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Subject: [PATCH v4 3/4] service: abstract the more complex autoconnect
conditionals
Message-ID: <[email protected]>
Content-Type: text/plain
The previous commit complicated some of the conditionals in the
auto_connect_service, so split them in their own function and add
comments to make them easier to understand.
---
src/service.c | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/service.c b/src/service.c
index e86718a..1784bf1 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3763,6 +3763,34 @@ static bool always_connect(enum connman_service_type
type)
return false;
}
+static bool autoconnect_no_session_active(struct connman_service *service)
+{
+ /*
+ * Test active_count to see if there are no sessions set up and
+ * stop autoconnecting, but continue connecting if the service
+ * belongs to a technology which should always autoconnect.
+ */
+ if (!active_count && !always_connect(service->type))
+ return true;
+
+ return false;
+}
+
+static bool autoconnect_already_connecting(struct connman_service *service,
+ bool autoconnecting)
+{
+ /*
+ * If another service is already connecting and this service type has
+ * not been marked as always connecting, stop the connecting procedure.
+ */
+ if (autoconnecting &&
+ !active_sessions[service->type] &&
+ !always_connect(service->type))
+ return true;
+
+ return false;
+}
+
static bool auto_connect_service(GList *services,
enum connman_service_connect_reason reason,
bool preferred)
@@ -3789,7 +3817,7 @@ static bool auto_connect_service(GList *services,
if (service->pending ||
is_connecting(service) ||
is_connected(service)) {
- if (!active_count && !always_connect(service->type))
+ if (autoconnect_no_session_active(service))
return true;
ignore[service->type] = true;
@@ -3812,9 +3840,7 @@ static bool auto_connect_service(GList *services,
CONNMAN_SERVICE_STATE_IDLE)
continue;
- if (autoconnecting &&
- !active_sessions[service->type] &&
- !always_connect(service->type)) {
+ if (autoconnect_already_connecting(service, autoconnecting)) {
DBG("service %p type %s has no users", service,
__connman_service_type2string(service->type));
continue;
@@ -3825,7 +3851,7 @@ static bool auto_connect_service(GList *services,
__connman_service_connect(service, reason);
- if (!active_count && !always_connect(service->type))
+ if (autoconnect_no_session_active(service))
return true;
ignore[service->type] = true;
--
2.10.2
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 13, Issue 17
***************************************