diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-05-15 15:01:56 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-06-01 16:17:29 +0000 |
commit | 472fb96bbe758a7ba11c184ea7c04e328c27fd97 (patch) | |
tree | aba42ac4dfa0f0cc34e9316abd3a0647a8c448fd | |
parent | 15543794b781266af31e613faea2d904afcee54e (diff) |
huawei: don't delay reporting network initiated disconnects
When a network-initiated event is received telling us that a
bearer/context is disconnected, we should handle and process it right
away, without thinking on whether there is going to be a
user-requested disconnect afterwards or not.
This effectively reverts the changes introduced in commit
21a5aaf4fe6934aad2e6c770aa4bdffa3ad29f9d, which looks like was done to
handle synchronization issues with upper layers (e.g. with
NetworkManager or Shill).
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/205
-rw-r--r-- | plugins/huawei/mm-broadband-bearer-huawei.c | 59 | ||||
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 7 |
2 files changed, 2 insertions, 64 deletions
diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c index 81a2e5a7..4206f194 100644 --- a/plugins/huawei/mm-broadband-bearer-huawei.c +++ b/plugins/huawei/mm-broadband-bearer-huawei.c @@ -37,8 +37,6 @@ G_DEFINE_TYPE (MMBroadbandBearerHuawei, mm_broadband_bearer_huawei, MM_TYPE_BROA struct _MMBroadbandBearerHuaweiPrivate { gpointer connect_pending; gpointer disconnect_pending; - /* Tag for the post task for network-initiated disconnect */ - guint network_disconnect_pending_id; }; /*****************************************************************************/ @@ -342,11 +340,6 @@ connect_3gpp_context_step (GTask *task) return; } - /* Network-initiated disconnect should not be outstanding at this point, - * because it interferes with the connect attempt. - */ - g_assert (self->priv->network_disconnect_pending_id == 0); - switch (ctx->step) { case CONNECT_3GPP_CONTEXT_STEP_FIRST: { MMBearerIpFamily ip_family; @@ -694,15 +687,6 @@ disconnect_3gpp_context_step (GTask *task) case DISCONNECT_3GPP_CONTEXT_STEP_FIRST: /* Store the task */ self->priv->disconnect_pending = task; - - /* We ignore any pending network-initiated disconnection in order to prevent it - * from interfering with the client-initiated disconnection, as we would like to - * proceed with the latter anyway. */ - if (self->priv->network_disconnect_pending_id != 0) { - g_source_remove (self->priv->network_disconnect_pending_id); - self->priv->network_disconnect_pending_id = 0; - } - ctx->step++; /* fall through */ @@ -804,17 +788,6 @@ disconnect_3gpp (MMBroadbandBearer *_self, /*****************************************************************************/ -static gboolean -network_disconnect_3gpp_delayed (MMBroadbandBearerHuawei *self) -{ - mm_obj_dbg (self, "disconnect bearer on network request"); - - self->priv->network_disconnect_pending_id = 0; - mm_base_bearer_report_connection_status (MM_BASE_BEARER (self), - MM_BEARER_CONNECTION_STATUS_DISCONNECTED); - return G_SOURCE_REMOVE; -} - static void report_connection_status (MMBaseBearer *bearer, MMBearerConnectionStatus status) @@ -837,23 +810,6 @@ report_connection_status (MMBaseBearer *bearer, if (status == MM_BEARER_CONNECTION_STATUS_CONNECTED) return; - /* We already use ^NDISSTATQRY? to poll the connection status, so only - * handle network-initiated disconnection here. */ - if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTING) { - /* MM_BEARER_CONNECTION_STATUS_DISCONNECTING is used to indicate that the - * reporting of disconnection should be delayed. See MMBroadbandModemHuawei's - * bearer_report_connection_status for details. */ - if (mm_base_bearer_get_status (bearer) == MM_BEARER_STATUS_CONNECTED && - self->priv->network_disconnect_pending_id == 0) { - mm_obj_dbg (self, "delay network-initiated disconnection of bearer"); - self->priv->network_disconnect_pending_id = (g_timeout_add_seconds ( - 4, - (GSourceFunc) network_disconnect_3gpp_delayed, - self)); - } - return; - } - /* Report disconnected right away */ MM_BASE_BEARER_CLASS (mm_broadband_bearer_huawei_parent_class)->report_connection_status ( bearer, @@ -882,19 +838,6 @@ mm_broadband_bearer_huawei_new_finish (GAsyncResult *res, return MM_BASE_BEARER (bearer); } -static void -dispose (GObject *object) -{ - MMBroadbandBearerHuawei *self = MM_BROADBAND_BEARER_HUAWEI (object); - - if (self->priv->network_disconnect_pending_id != 0) { - g_source_remove (self->priv->network_disconnect_pending_id); - self->priv->network_disconnect_pending_id = 0; - } - - G_OBJECT_CLASS (mm_broadband_bearer_huawei_parent_class)->dispose (object); -} - void mm_broadband_bearer_huawei_new (MMBroadbandModemHuawei *modem, MMBearerProperties *config, @@ -931,8 +874,6 @@ mm_broadband_bearer_huawei_class_init (MMBroadbandBearerHuaweiClass *klass) g_type_class_add_private (object_class, sizeof (MMBroadbandBearerHuaweiPrivate)); - object_class->dispose = dispose; - base_bearer_class->report_connection_status = report_connection_status; base_bearer_class->load_connection_status = NULL; base_bearer_class->load_connection_status_finish = NULL; diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index ceae7795..a676b7a7 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -1648,14 +1648,11 @@ bearer_report_connection_status (MMBaseBearer *bearer, { if (ndisstat_result->ipv4_available) { /* TODO: MMBroadbandBearerHuawei does not currently support IPv6. - * When it does, we should check the IP family associated with each bearer. - * - * Also, send DISCONNECTING so that we give some time before actually - * disconnecting the connection */ + * When it does, we should check the IP family associated with each bearer. */ mm_base_bearer_report_connection_status (bearer, ndisstat_result->ipv4_connected ? MM_BEARER_CONNECTION_STATUS_CONNECTED : - MM_BEARER_CONNECTION_STATUS_DISCONNECTING); + MM_BEARER_CONNECTION_STATUS_DISCONNECTED); } } |