summaryrefslogtreecommitdiffstats
path: root/src/gprs.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-06-02 02:35:39 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-06-02 15:56:18 -0500
commitea07cbfa1be3ce4573aa35c6ff06aca1384957d6 (patch)
treeb77d810b8217e3d021c27caea6f7bdf9a2a250ad /src/gprs.c
parentd573a3a57ceaf3a10e0f15e52e7e561ad50405d0 (diff)
downloadofono-ea07cbfa1be3ce4573aa35c6ff06aca1384957d6.tar.bz2
gprs: Unify logic inside registration_status_cb
And delay reseting the ATTACHING flag until we had a chance to query the CGREG status.
Diffstat (limited to 'src/gprs.c')
-rw-r--r--src/gprs.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gprs.c b/src/gprs.c
index 559a43d3..acbfa563 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1489,8 +1489,12 @@ static void registration_status_cb(const struct ofono_error *error,
DBG("%s error %d status %d", __ofono_atom_get_path(gprs->atom),
error->type, status);
+ gprs->flags &= ~GPRS_FLAG_ATTACHING;
+
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
ofono_gprs_status_notify(gprs, status);
+ else
+ gprs_attached_update(gprs);
if (gprs->flags & GPRS_FLAG_RECHECK) {
gprs->flags &= ~GPRS_FLAG_RECHECK;
@@ -1504,23 +1508,20 @@ static void gprs_attach_callback(const struct ofono_error *error, void *data)
DBG("%s error = %d", __ofono_atom_get_path(gprs->atom), error->type);
- gprs->flags &= ~GPRS_FLAG_ATTACHING;
-
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
gprs->driver_attached = !gprs->driver_attached;
- if (gprs->driver->attached_status) {
- gprs->driver->attached_status(gprs, registration_status_cb,
- gprs);
- return;
- }
+ if (gprs->driver->attached_status == NULL) {
+ struct ofono_error error;
- gprs_attached_update(gprs);
+ error.type = OFONO_ERROR_TYPE_FAILURE;
+ error.error = 0;
- if (gprs->flags & GPRS_FLAG_RECHECK) {
- gprs->flags &= ~GPRS_FLAG_RECHECK;
- gprs_netreg_update(gprs);
+ registration_status_cb(&error, -1, gprs);
+ return;
}
+
+ gprs->driver->attached_status(gprs, registration_status_cb, gprs);
}
static void gprs_netreg_removed(struct ofono_gprs *gprs)