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.
This commit is contained in:
Alfonso Sanchez-Beato 2016-04-04 18:11:48 +02:00 committed by Denis Kenzior
parent 31d2dfcfbe
commit 154f4aca65
1 changed files with 6 additions and 0 deletions

View File

@ -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;
}