Skip to content

Commit

Permalink
[ril] Tweaked network state polling logic
Browse files Browse the repository at this point in the history
grilio_channel_retry_request() returns FALSE if the request is pending,
i.e. has been submitted but there was no reply yet. In that case, in
order to retry right away, we need to cancel the already submitted
request (and ignore the reply when it arrives) and resubmit a fresh
new one.
  • Loading branch information
monich committed Apr 15, 2021
1 parent 0f4cdba commit 09e9823
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ofono/drivers/ril/ril_network.c
Expand Up @@ -444,14 +444,13 @@ static guint ril_network_poll_and_retry(struct ril_network *self, guint id,
{
struct ril_network_priv *priv = self->priv;

if (id) {
/* Retry right away, don't wait for retry timeout to expire */
grilio_channel_retry_request(priv->io, id);
} else {
/* Don't wait for retry timeout to expire */
if (!id || !grilio_channel_retry_request(priv->io, id)) {
GRilIoRequest *req = grilio_request_new();

grilio_request_set_retry(req, RIL_RETRY_SECS*1000, -1);
grilio_request_set_retry_func(req, ril_network_retry);
grilio_queue_cancel_request(priv->q, id, FALSE);
id = grilio_queue_send_request_full(priv->q, req, code, fn,
NULL, self);
grilio_request_unref(req);
Expand Down

0 comments on commit 09e9823

Please sign in to comment.