From: Guoqiang Liu <[email protected]>
ConnMan use a volatile variable tethering_enabled to count
the tether bridge users. and only destroy the tether bridge
when tethering_enabled is 0.
If two or more technologies turn on tethering at the same
times, and then turn off all the technologies' tethering
featrue, the tethering_enabled will only -1.
The reason is ConnMan use __connman_tethering_set_disabled
to decrease tethering_enabled. and the function will be
invoked only when there is no technology with techering
feature on in technology_list, when two or more technologeis
turn off tethering, only last one can decrease tethering_enabled.
---
src/technology.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/technology.c b/src/technology.c
index ce922be..28ea3c6 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -290,8 +290,6 @@ static void tethering_changed(struct connman_technology
*technology)
void connman_technology_tethering_notify(struct connman_technology *technology,
bool enabled)
{
- GSList *list;
-
DBG("technology %p enabled %u", technology, enabled);
if (technology->tethering == enabled)
@@ -303,15 +301,8 @@ void connman_technology_tethering_notify(struct
connman_technology *technology,
if (enabled)
__connman_tethering_set_enabled();
- else {
- for (list = technology_list; list; list = list->next) {
- struct connman_technology *other_tech = list->data;
- if (other_tech->tethering)
- break;
- }
- if (!list)
- __connman_tethering_set_disabled();
- }
+ else
+ __connman_tethering_set_disabled();
}
static int set_tethering(struct connman_technology *technology,
--
1.7.9.5
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman