mirror of git://git.sysmocom.de/ofono
atmodem: Fix a race if a context get deactivated while read
When a context gets activated we read its settings, but if the context gets deactivated during this time we should not indicate that the context is activated when the settings are received.
This commit is contained in:
parent
c92d23fab9
commit
9b1dae2e62
|
@ -161,6 +161,11 @@ static void at_cgdcont_read_cb(gboolean ok, GAtResult *result,
|
|||
return;
|
||||
}
|
||||
|
||||
if (gd->last_auto_context_id == 0) {
|
||||
DBG("Context got deactivated while calling CGDCONT");
|
||||
return;
|
||||
}
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
||||
while (g_at_result_iter_next(&iter, "+CGDCONT:")) {
|
||||
|
@ -251,6 +256,12 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
g_at_chat_send(gd->chat, "AT+CGDCONT?", cgdcont_prefix,
|
||||
at_cgdcont_read_cb, gprs, NULL);
|
||||
} else if (g_str_has_prefix(event, "ME PDN DEACT")) {
|
||||
unsigned int context_id;
|
||||
sscanf(event, "%*s %*s %*s %u", &context_id);
|
||||
/* Indicate that this cid is not activated anymore */
|
||||
if (gd->last_auto_context_id == context_id)
|
||||
gd->last_auto_context_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue