bearer: avoid reporting disconnection error if already disconnected
When we try to disconnect a bearer and the bearer is already disconnected (e.g. after a cancelled connection attempt), avoid reporting that as an error: <warn> [1575287560.433398] Error disconnecting bearer '/org/freedesktop/ModemManager1/Bearer/0': 'Couldn't disconnect QMI bearer: this bearer is not connected'. Will assume disconnected anyway.
This commit is contained in:
+9
-13
@@ -1319,21 +1319,18 @@ disconnect (MMBaseBearer *_self,
|
||||
DisconnectContext *ctx;
|
||||
GTask *task;
|
||||
|
||||
if (!self->priv->data) {
|
||||
g_task_report_new_error (
|
||||
self,
|
||||
callback,
|
||||
user_data,
|
||||
disconnect,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't disconnect MBIM bearer: this bearer is not connected");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!peek_ports (self, &device, NULL, callback, user_data))
|
||||
return;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
if (!self->priv->data) {
|
||||
mm_dbg ("No need to disconnect: MBIM bearer is already disconnected");
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_dbg ("Launching disconnection on data port (%s/%s)",
|
||||
mm_port_subsys_get_string (mm_port_get_subsys (self->priv->data)),
|
||||
mm_port_get_device (self->priv->data));
|
||||
@@ -1343,7 +1340,6 @@ disconnect (MMBaseBearer *_self,
|
||||
ctx->data = g_object_ref (self->priv->data);
|
||||
ctx->step = DISCONNECT_STEP_FIRST;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)disconnect_context_free);
|
||||
|
||||
/* Run! */
|
||||
|
||||
+5
-8
@@ -2031,18 +2031,15 @@ disconnect (MMBaseBearer *_self,
|
||||
DisconnectContext *ctx;
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
if ((!self->priv->packet_data_handle_ipv4 && !self->priv->packet_data_handle_ipv6) ||
|
||||
(!self->priv->client_ipv4 && !self->priv->client_ipv6) ||
|
||||
!self->priv->data ||
|
||||
!self->priv->qmi) {
|
||||
g_task_report_new_error (
|
||||
self,
|
||||
callback,
|
||||
user_data,
|
||||
disconnect,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't disconnect QMI bearer: this bearer is not connected");
|
||||
mm_dbg ("No need to disconnect: QMI bearer is already disconnected");
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+10
-18
@@ -1805,15 +1805,12 @@ disconnect (MMBaseBearer *self,
|
||||
MMBaseModem *modem = NULL;
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
if (!MM_BROADBAND_BEARER (self)->priv->port) {
|
||||
g_task_report_new_error (
|
||||
self,
|
||||
callback,
|
||||
user_data,
|
||||
disconnect,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't disconnect: this bearer is not connected");
|
||||
mm_dbg ("No need to disconnect: bearer is already disconnected");
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1825,20 +1822,15 @@ disconnect (MMBaseBearer *self,
|
||||
/* We need the primary port to disconnect... */
|
||||
primary = mm_base_modem_peek_port_primary (modem);
|
||||
if (!primary) {
|
||||
g_task_report_new_error (
|
||||
self,
|
||||
callback,
|
||||
user_data,
|
||||
disconnect,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't disconnect: couldn't get primary port");
|
||||
g_task_return_new_error (task,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't disconnect: couldn't get primary port");
|
||||
g_object_unref (task);
|
||||
g_object_unref (modem);
|
||||
return;
|
||||
}
|
||||
|
||||
task = g_task_new (self, NULL, callback , user_data);
|
||||
|
||||
switch (MM_BROADBAND_BEARER (self)->priv->connection_type) {
|
||||
case CONNECTION_TYPE_3GPP:
|
||||
MM_BROADBAND_BEARER_GET_CLASS (self)->disconnect_3gpp (
|
||||
|
||||
Reference in New Issue
Block a user