diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-02-25 15:42:35 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-03-10 10:59:22 +0100 |
commit | 05b9ab7c25bf252e43037ed0ea002b0aed6f051b (patch) | |
tree | 996bf3a13e114298d450ce10136a6838d9f00006 /src/mm-iface-modem.c | |
parent | 35e20a48c8b16ae744c4ca3082f70e8aa674c2f4 (diff) |
api,modem: new 'MaxActiveMultiplexedBearers' property
In addition to the amount of bearers a user may connect without
multiplexing enabled (the default until now), we now also expose the
maximum number of bearers a user may connect after enabling
multiplexing over one single network interface (if supported).
The method responsible for creating the MMBearerList is now also
subclassable, so that implementations supporting multiplexing can
provide their own version with their own thresholds.
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r-- | src/mm-iface-modem.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 5ac3da9c..20580d8f 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -5083,47 +5083,38 @@ interface_initialization_step (GTask *task) /* fall-through */ case INITIALIZATION_STEP_BEARERS: { - MMBearerList *list = NULL; + g_autoptr(MMBearerList) list = NULL; /* Bearers setup is meant to be loaded only once during the whole - * lifetime of the modem. The list may have been created by the object - * implementing the interface; if so use it. */ + * lifetime of the modem, so check if it exists; and if it doesn't, + * create it right away. */ g_object_get (self, MM_IFACE_MODEM_BEARER_LIST, &list, NULL); if (!list) { - guint n; - - /* The maximum number of available/connected modems is guessed from - * the size of the data ports list. */ - n = g_list_length (mm_base_modem_peek_data_ports (MM_BASE_MODEM (self))); - mm_obj_dbg (self, "allowed up to %u active bearers", n); - - /* Create new default list */ - list = mm_bearer_list_new (n); + list = MM_IFACE_MODEM_GET_INTERFACE (self)->create_bearer_list (self); g_signal_connect (list, "notify::" MM_BEARER_LIST_NUM_BEARERS, G_CALLBACK (bearer_list_updated), self); - g_object_set (self, - MM_IFACE_MODEM_BEARER_LIST, list, - NULL); - } - if (mm_gdbus_modem_get_max_active_bearers (ctx->skeleton) == 0) mm_gdbus_modem_set_max_active_bearers ( ctx->skeleton, mm_bearer_list_get_max_active (list)); + mm_gdbus_modem_set_max_active_multiplexed_bearers ( + ctx->skeleton, + mm_bearer_list_get_max_active_multiplexed (list)); - /* MaxBearers set equal to MaxActiveBearers */ - if (mm_gdbus_modem_get_max_bearers (ctx->skeleton) == 0) + /* MaxBearers set equal to MaxActiveBearers */ mm_gdbus_modem_set_max_bearers ( ctx->skeleton, mm_gdbus_modem_get_max_active_bearers (ctx->skeleton)); - g_object_unref (list); - + g_object_set (self, + MM_IFACE_MODEM_BEARER_LIST, list, + NULL); + } ctx->step++; } /* fall-through */ |