[PATCH 5/6] base-bearer: setup periodic stats loading

Aleksander Morgado aleksander at aleksander.es
Mon Nov 30 14:25:19 PST 2015


On Mon, Nov 30, 2015 at 5:33 PM, Dan Williams <dcbw at redhat.com> wrote:
>> +static gboolean
>> +stats_update_cb (MMBaseBearer *self)
>> +{
>> +    /* If the implementation knows how to update stat values, run it
>> */
>> +    if (MM_BASE_BEARER_GET_CLASS (self)->reload_stats &&
>> +        MM_BASE_BEARER_GET_CLASS (self)->reload_stats_finish) {
>> +        MM_BASE_BEARER_GET_CLASS (self)->reload_stats (
>> +            self,
>> +            (GAsyncReadyCallback)reload_stats_ready,
>> +            NULL);
>> +        return TRUE;
>> +    }
>> +
>> +    /* Otherwise, just update duration and we're done */
>> +    mm_bearer_stats_set_duration (self->priv->stats, (guint32)
>> g_timer_elapsed (self->priv->duration_timer, NULL));
>> +    mm_bearer_stats_set_bytes_tx (self->priv->stats, 0);
>> +    mm_bearer_stats_set_bytes_rx (self->priv->stats, 0);
>> +    bearer_update_interface_stats (self);
>> +    return TRUE;
>>
> I'm a fan of G_SOURCE_CONTINUE/G_SOURCE_REMOVE these days, but that's
> personal preference.

Ah! I had to fire up devhelp to see what those were :). Yeah, I guess
the names are a bit easier to remember than the true/false logic. How
about a follow up patch changing the TRUE/FALSE values in all
GSourceFuncs everywhere in the code?

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list