gprs: Fix to attachment race condition

Sometimes we get unsolicited attachment status before our query
finishes.  If the client is fast enough they can attempt to attach
and get the AttachInProgress error
This commit is contained in:
Denis Kenzior 2010-06-25 12:18:14 -05:00
parent bd8930579b
commit f3e0e466c7
1 changed files with 4 additions and 6 deletions

View File

@ -896,8 +896,6 @@ static void registration_status_cb(const struct ofono_error *error,
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
ofono_gprs_status_notify(gprs, status);
gprs->flags &= ~GPRS_FLAG_ATTACHING;
if (gprs->flags & GPRS_FLAG_RECHECK) {
gprs->flags &= ~GPRS_FLAG_RECHECK;
gprs_netreg_update(gprs);
@ -908,9 +906,9 @@ static void gprs_attach_callback(const struct ofono_error *error, void *data)
{
struct ofono_gprs *gprs = data;
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
gprs_attached_update(gprs);
else
gprs->flags &= ~GPRS_FLAG_ATTACHING;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
gprs->driver_attached = !gprs->driver_attached;
if (gprs->driver->attached_status) {
@ -919,7 +917,7 @@ static void gprs_attach_callback(const struct ofono_error *error, void *data)
return;
}
gprs->flags &= ~GPRS_FLAG_ATTACHING;
gprs_attached_update(gprs);
if (gprs->flags & GPRS_FLAG_RECHECK) {
gprs->flags &= ~GPRS_FLAG_RECHECK;