From: Denis Kenzior Date: Mon, 8 Feb 2010 21:33:17 +0000 (-0600) Subject: Fix: Tweak gprs attach logic X-Git-Tag: 0.18~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea771ec186613c365a5404c6c178db512f651795;p=platform%2Fupstream%2Fofono.git Fix: Tweak gprs attach logic We use driver_attached to track whether the driver is attached / attaching. Unfortunately we only set it when set_attached succeeds. Instead we should set it right away when calling set_attached, so we cover pending attaches as well. --- diff --git a/src/gprs.c b/src/gprs.c index d517367..91b92f2 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -988,10 +988,10 @@ 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->driver_attached = !gprs->driver_attached; + if (error->type == OFONO_ERROR_TYPE_NO_ERROR) gprs_attached_update(gprs); - } + else + gprs->driver_attached = !gprs->driver_attached; if (gprs->driver->registration_status) { gprs->driver->registration_status(gprs, registration_status_cb, @@ -1029,6 +1029,7 @@ static void gprs_netreg_update(struct ofono_gprs *gprs) gprs->flags |= GPRS_FLAG_ATTACHING; gprs->driver->set_attached(gprs, attach, gprs_attach_callback, gprs); + gprs->driver_attached = attach; } static void netreg_status_changed(int status, int lac, int ci, int tech, @@ -1422,8 +1423,7 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status, int lac, int ci, int tech) { /* If we are not attached and haven't tried to attach, ignore */ - if (gprs->driver_attached == FALSE && - (gprs->flags & GPRS_FLAG_ATTACHING) == 0) + if (gprs->driver_attached == FALSE) return; if (gprs->status != status)