aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-02-25 14:43:22 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-03-10 10:59:22 +0100
commit35e20a48c8b16ae744c4ca3082f70e8aa674c2f4 (patch)
tree2b23fb243ebc151bbac167f9165f5b1cfef6390e /src/mm-iface-modem.c
parent064e92e9b77b35f83cb522c6ea98b9016ce5db8c (diff)
api,modem: deprecate the 'MaxBearers' property
This property was never initialized with a correct value, we would always use the same value as used for MaxActiveBearers, which isn't technically right. Just suggest to ignore this property, and flag it as deprecated. In addition to deprecating the API property, we will internally no longer limit the amount of bearer objects that may be created with different connection settings. The bearer object exposed in DBus is a representation of the connection that may be setup, and so we can hold as many representations as we want as long as the amount of connected bearers doesn't exceed the maximum amount for each modem. Leaving around the disconnected modems also serves another purpose. Each bearer holds information about the amount of times a connection with it has been attempted, and the amount of data transferred through it. If we use the Simple.Connect() method to connect the modem using different bearer settings, we won't lose the information of the past connection attempts with different settings.
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r--src/mm-iface-modem.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 2e9a3004..5ac3da9c 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -670,17 +670,6 @@ mm_iface_modem_create_bearer (MMIfaceModem *self,
return;
}
- if (mm_bearer_list_get_count (ctx->list) == mm_bearer_list_get_max (ctx->list)) {
- g_task_return_new_error (
- task,
- MM_CORE_ERROR,
- MM_CORE_ERROR_TOO_MANY,
- "Cannot add new bearer: already reached maximum (%u)",
- mm_bearer_list_get_count (ctx->list));
- g_object_unref (task);
- return;
- }
-
MM_IFACE_MODEM_GET_INTERFACE (self)->create_bearer (
self,
properties,
@@ -5109,10 +5098,10 @@ interface_initialization_step (GTask *task)
/* 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 bearers", n);
+ mm_obj_dbg (self, "allowed up to %u active bearers", n);
/* Create new default list */
- list = mm_bearer_list_new (n, n);
+ list = mm_bearer_list_new (n);
g_signal_connect (list,
"notify::" MM_BEARER_LIST_NUM_BEARERS,
G_CALLBACK (bearer_list_updated),
@@ -5122,14 +5111,17 @@ interface_initialization_step (GTask *task)
NULL);
}
- if (mm_gdbus_modem_get_max_bearers (ctx->skeleton) == 0)
- mm_gdbus_modem_set_max_bearers (
- ctx->skeleton,
- mm_bearer_list_get_max (list));
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));
+
+ /* MaxBearers set equal to MaxActiveBearers */
+ if (mm_gdbus_modem_get_max_bearers (ctx->skeleton) == 0)
+ mm_gdbus_modem_set_max_bearers (
+ ctx->skeleton,
+ mm_gdbus_modem_get_max_active_bearers (ctx->skeleton));
+
g_object_unref (list);
ctx->step++;