From f3e0e466c7ad396cdf79bc9717a0e2c24050319e Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 25 Jun 2010 12:18:14 -0500 Subject: 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 --- src/gprs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gprs.c b/src/gprs.c index 11876e23..cf4f6267 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -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; -- cgit v1.2.3