summaryrefslogtreecommitdiff
path: root/src/gprs.c
diff options
context:
space:
mode:
authorAlfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>2016-04-04 18:11:48 +0200
committerDenis Kenzior <denkenz@gmail.com>2016-04-04 14:48:05 -0500
commit154f4aca65b3b419239be75d0def276bd7f4dc8e (patch)
tree9561ac100e6f3b4455b1a7d3cd49a427aaf0b6e4 /src/gprs.c
parent31d2dfcfbed952bef0130a80356b081e184ea255 (diff)
downloadofono-154f4aca65b3b419239be75d0def276bd7f4dc8e.tar.gz
gprs: Deactivate old contexts on attach
In some cases it is possible that a context is opened after a detach event has been received, and right before an attach, depending on the modem. We make sure that those contexts are removed to keep consistency.
Diffstat (limited to 'src/gprs.c')
-rw-r--r--src/gprs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gprs.c b/src/gprs.c
index 3acb412a..3a4a8191 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1624,6 +1624,12 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
release_active_contexts(gprs);
gprs->bearer = -1;
} else if (have_active_contexts(gprs) == TRUE) {
+ /*
+ * Some times the context activates after a detach event and
+ * right before an attach. We close it to avoid unexpected open
+ * contexts.
+ */
+ release_active_contexts(gprs);
gprs->flags |= GPRS_FLAG_ATTACHED_UPDATE;
return;
}