mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 11:40:08 +01:00
wwan: retry connect on some errors and save them for log messages
First,cb751012a2mistakenly converted the act_stage_context_step() in connect_ready() to connect_context_clear() instead of connect_context_step(). This would cause the IP Type retry logic to fail and no further types to be tried. It also throws away the ctx->first_error and causes all errors that MM returns on the connect attempt to be dropped on the floor. Second, not all errors should cause an advance to the next IP Type, since some errors aren't related to it. Specifically, MM_CORE_ERROR_RETRY when using Simple.Connect() means that a timeout was reached in the internal connect logic, not a modem or network error. In that case, try the connect again with the same IP Type before advancing to the next type. Fixes:cb751012a2Tested-by: Ladislav Michl <ladis@linux-mips.org> Tested-by: Tore Anderson <tore@fud.no> (cherry picked from commit1cf4727766)
This commit is contained in:
parent
30bedd0b39
commit
f2773e525c
1 changed files with 15 additions and 7 deletions
|
|
@ -53,6 +53,7 @@ typedef struct {
|
|||
MMSimpleConnectProperties *connect_properties;
|
||||
GArray *ip_types;
|
||||
guint ip_types_i;
|
||||
guint ip_type_tries;
|
||||
GError *first_error;
|
||||
} ConnectContext;
|
||||
|
||||
|
|
@ -332,11 +333,17 @@ connect_ready (MMModemSimple *simple_iface,
|
|||
} else
|
||||
g_error_free (error);
|
||||
|
||||
/* If the modem/provider lies and the IP type we tried isn't supported,
|
||||
* retry with the next one, if any.
|
||||
*/
|
||||
ctx->ip_types_i++;
|
||||
connect_context_clear (self);
|
||||
if (ctx->ip_type_tries == 0 && g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_RETRY)) {
|
||||
/* Try one more time */
|
||||
ctx->ip_type_tries++;
|
||||
} else {
|
||||
/* If the modem/provider lies and the IP type we tried isn't supported,
|
||||
* retry with the next one, if any.
|
||||
*/
|
||||
ctx->ip_types_i++;
|
||||
ctx->ip_type_tries = 0;
|
||||
}
|
||||
connect_context_step (self);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -486,9 +493,10 @@ connect_context_step (NMModemBroadband *self)
|
|||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
nm_log_dbg (LOGD_MB, "(%s): launching connection with ip type '%s'",
|
||||
nm_log_dbg (LOGD_MB, "(%s): launching connection with ip type '%s' (try %d)",
|
||||
nm_modem_get_uid (NM_MODEM (self)),
|
||||
nm_modem_ip_type_to_string (current));
|
||||
nm_modem_ip_type_to_string (current),
|
||||
ctx->ip_type_tries + 1);
|
||||
|
||||
mm_modem_simple_connect (self->priv->simple_iface,
|
||||
ctx->connect_properties,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue