core,plugins: consolidate connection/disconnection timeout values
Each different plugin or protocol had a different connection attempt value. E.g. QMI and MBIM both used 60s max for the connection attempt, while the u-blox plugin had up to 180s for ECM based connection setups. This commit consolidates all plugins and protocols to use the same timeout values for commands that may take long to respond, e.g. a connection atempt under low signal quality conditions. A value of 180s for the connection attempt steps and 120s for a disconnection attempt step is considered. Note, though, that in some cases (like a IPv4v6 setup attempt using QMI) we may have more than one such long step, so this doesn't mean that a connection attempt will always take less than 180s. Users of the connection/disconnection APIs should be able to handle the case where the attempt times out in their side (e.g. with a lower DBus request timeout), and which would not mean the actual request they did really failed. E.g. a connection attempt with a DBus timeout of 30s may fail in the user with a timeout error, but the attempt would still go on for as much as the plugin/protocol needs. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/270
This commit is contained in:
@@ -119,7 +119,7 @@ connect_3gpp_apnsettings_ready (MMBaseModem *modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
"%DPDNACT=1",
|
||||
20, /* timeout */
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT, /* timeout */
|
||||
FALSE, /* allow_cached */
|
||||
FALSE, /* is_raw */
|
||||
g_task_get_cancellable (task),
|
||||
@@ -296,7 +296,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
"%DPDNACT=0",
|
||||
20, /* timeout */
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT, /* timeout */
|
||||
FALSE, /* allow_cached */
|
||||
FALSE, /* is_raw */
|
||||
NULL, /* cancellable */
|
||||
|
||||
@@ -356,7 +356,7 @@ dial_3gpp_context_step (GTask *task)
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
180,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
@@ -553,7 +553,7 @@ disconnect_3gpp_context_step (GTask *task)
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
10,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
|
||||
@@ -327,7 +327,7 @@ connect_3gpp_context_step (GTask *task)
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
"^NDISDUP=1,0",
|
||||
3,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
@@ -417,11 +417,11 @@ connect_3gpp_context_step (GTask *task)
|
||||
}
|
||||
|
||||
case CONNECT_3GPP_CONTEXT_STEP_NDISSTATQRY:
|
||||
/* Wait for dial up timeout, retries for 60 times
|
||||
* (1s between the retries, so it means 1 minute).
|
||||
/* Wait for dial up timeout, retries for 180 times
|
||||
* (1s between the retries, so it means 3 minutes).
|
||||
* If too many retries, failed
|
||||
*/
|
||||
if (ctx->check_count > 60) {
|
||||
if (ctx->check_count > MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT) {
|
||||
/* Clear context */
|
||||
self->priv->connect_pending = NULL;
|
||||
g_task_return_new_error (task,
|
||||
@@ -701,7 +701,7 @@ disconnect_3gpp_context_step (GTask *task)
|
||||
|
||||
case DISCONNECT_3GPP_CONTEXT_STEP_NDISSTATQRY:
|
||||
/* If too many retries (1s of wait between the retries), failed */
|
||||
if (ctx->check_count > 60) {
|
||||
if (ctx->check_count > MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT) {
|
||||
/* Clear task */
|
||||
self->priv->disconnect_pending = NULL;
|
||||
g_task_return_new_error (task,
|
||||
|
||||
@@ -364,7 +364,7 @@ disconnect_3gpp (MMBroadbandBearer *bearer,
|
||||
MM_BASE_MODEM (modem),
|
||||
primary,
|
||||
command,
|
||||
60,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
@@ -437,7 +437,7 @@ connect_reset (GTask *task)
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
3,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
@@ -624,7 +624,7 @@ activate_ready (MMBaseModem *modem,
|
||||
* Reports of modem being connected will arrive via unsolicited messages.
|
||||
* This timeout should be long enough. Actually... ideally should never get
|
||||
* reached. */
|
||||
self->priv->connect_pending_id = g_timeout_add_seconds (60,
|
||||
self->priv->connect_pending_id = g_timeout_add_seconds (MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
(GSourceFunc)connect_timed_out_cb,
|
||||
self);
|
||||
|
||||
@@ -698,7 +698,7 @@ authenticate_ready (MMBaseModem *modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
60,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
@@ -812,7 +812,7 @@ connect_deactivate (GTask *task)
|
||||
ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
60,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
|
||||
@@ -165,7 +165,7 @@ service_type_ready (MMBaseModem *modem,
|
||||
modem,
|
||||
ctx->primary,
|
||||
"ATDT008816000025",
|
||||
60,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
|
||||
@@ -232,7 +232,7 @@ connect_poll_cb (MMBroadbandBearerMbm *self)
|
||||
}
|
||||
|
||||
/* Too many retries... */
|
||||
if (ctx->poll_count > 50) {
|
||||
if (ctx->poll_count > MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT) {
|
||||
g_assert (!ctx->saved_error);
|
||||
ctx->saved_error = g_error_new (MM_MOBILE_EQUIPMENT_ERROR,
|
||||
MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT,
|
||||
@@ -318,7 +318,7 @@ activate (GTask *task)
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
3,
|
||||
10,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
g_task_get_cancellable (task),
|
||||
@@ -682,7 +682,7 @@ disconnect_poll_cb (MMBroadbandBearerMbm *self)
|
||||
ctx->poll_id = 0;
|
||||
|
||||
/* Too many retries... */
|
||||
if (ctx->poll_count > 20) {
|
||||
if (ctx->poll_count > MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT) {
|
||||
g_task_return_new_error (task,
|
||||
MM_MOBILE_EQUIPMENT_ERROR,
|
||||
MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT,
|
||||
|
||||
@@ -335,7 +335,7 @@ connect_3gpp (MMBroadbandBearer *self,
|
||||
ctx = g_slice_new0 (DetailedConnectContext);
|
||||
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
||||
ctx->primary = g_object_ref (primary);
|
||||
ctx->retries = 60;
|
||||
ctx->retries = MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT;
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)detailed_connect_context_free);
|
||||
@@ -498,7 +498,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
||||
ctx->primary = g_object_ref (primary);
|
||||
ctx->data = g_object_ref (data);
|
||||
ctx->retries = 60;
|
||||
ctx->retries = MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)detailed_disconnect_context_free);
|
||||
|
||||
@@ -410,7 +410,7 @@ activate_ready (MMBaseModem *modem,
|
||||
* Reports of modem being connected will arrive via unsolicited messages.
|
||||
* This timeout should be long enough. Actually... ideally should never get
|
||||
* reached. */
|
||||
self->priv->connect_pending_id = g_timeout_add_seconds (60,
|
||||
self->priv->connect_pending_id = g_timeout_add_seconds (MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
(GSourceFunc)connect_timed_out_cb,
|
||||
self);
|
||||
|
||||
@@ -686,7 +686,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (modem),
|
||||
primary,
|
||||
command,
|
||||
3,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
|
||||
@@ -407,7 +407,7 @@ dial_3gpp_context_step (GTask *task)
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
10,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
@@ -538,7 +538,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (modem),
|
||||
primary,
|
||||
command,
|
||||
3,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE, /* raw */
|
||||
NULL, /* cancellable */
|
||||
|
||||
@@ -379,7 +379,7 @@ activate_3gpp (GTask *task)
|
||||
mm_obj_dbg (self, "establishing ECM data connection for PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
cmd,
|
||||
180,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cedata_activate_ready,
|
||||
g_object_ref (self));
|
||||
@@ -396,7 +396,7 @@ activate_3gpp (GTask *task)
|
||||
mm_obj_dbg (self, "activating PDP context #%u...", ctx->cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (ctx->modem),
|
||||
cmd,
|
||||
120,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cgact_activate_ready,
|
||||
task);
|
||||
@@ -730,7 +730,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
mm_obj_dbg (self, "deactivating PDP context #%u...", cid);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (modem),
|
||||
cmd,
|
||||
120,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) cgact_deactivate_ready,
|
||||
task);
|
||||
|
||||
Reference in New Issue
Block a user