iface-modem: improve logging of user request to delete bearer
This commit is contained in:
@@ -1099,15 +1099,13 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
handle_delete_bearer_context_free (HandleDeleteBearerContext *ctx)
|
handle_delete_bearer_context_free (HandleDeleteBearerContext *ctx)
|
||||||
{
|
{
|
||||||
if (ctx->bearer)
|
|
||||||
g_object_unref (ctx->bearer);
|
|
||||||
g_object_unref (ctx->skeleton);
|
g_object_unref (ctx->skeleton);
|
||||||
g_object_unref (ctx->invocation);
|
g_object_unref (ctx->invocation);
|
||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
if (ctx->list)
|
g_clear_object (&ctx->bearer);
|
||||||
g_object_unref (ctx->list);
|
g_clear_object (&ctx->list);
|
||||||
g_free (ctx->bearer_path);
|
g_free (ctx->bearer_path);
|
||||||
g_free (ctx);
|
g_slice_free (HandleDeleteBearerContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1118,15 +1116,19 @@ delete_bearer_disconnect_ready (MMBaseBearer *bearer,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!mm_base_bearer_disconnect_finish (bearer, res, &error)) {
|
if (!mm_base_bearer_disconnect_finish (bearer, res, &error)) {
|
||||||
|
mm_obj_warn (ctx->self, "failed disconnecting bearer '%s' before deleting: %s", ctx->bearer_path, error->message);
|
||||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
handle_delete_bearer_context_free (ctx);
|
handle_delete_bearer_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mm_bearer_list_delete_bearer (ctx->list, ctx->bearer_path, &error))
|
if (!mm_bearer_list_delete_bearer (ctx->list, ctx->bearer_path, &error)) {
|
||||||
|
mm_obj_warn (ctx->self, "failed deleting bearer '%s': %s", ctx->bearer_path, error->message);
|
||||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
else
|
} else {
|
||||||
|
mm_obj_info (ctx->self, "deleted bearer '%s'", ctx->bearer_path);
|
||||||
mm_gdbus_modem_complete_delete_bearer (ctx->skeleton, ctx->invocation);
|
mm_gdbus_modem_complete_delete_bearer (ctx->skeleton, ctx->invocation);
|
||||||
|
}
|
||||||
handle_delete_bearer_context_free (ctx);
|
handle_delete_bearer_context_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,26 +1151,21 @@ handle_delete_bearer_auth_ready (MMBaseModem *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!g_str_has_prefix (ctx->bearer_path, MM_DBUS_BEARER_PREFIX)) {
|
if (!g_str_has_prefix (ctx->bearer_path, MM_DBUS_BEARER_PREFIX)) {
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||||
MM_CORE_ERROR,
|
"Invalid path '%s'", ctx->bearer_path);
|
||||||
MM_CORE_ERROR_INVALID_ARGS,
|
|
||||||
"Cannot delete bearer: invalid path '%s'",
|
|
||||||
ctx->bearer_path);
|
|
||||||
handle_delete_bearer_context_free (ctx);
|
handle_delete_bearer_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->bearer = mm_bearer_list_find_by_path (ctx->list, ctx->bearer_path);
|
ctx->bearer = mm_bearer_list_find_by_path (ctx->list, ctx->bearer_path);
|
||||||
if (!ctx->bearer) {
|
if (!ctx->bearer) {
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||||
MM_CORE_ERROR,
|
"No bearer found with path '%s'", ctx->bearer_path);
|
||||||
MM_CORE_ERROR_INVALID_ARGS,
|
|
||||||
"Cannot delete bearer: no bearer found with path '%s'",
|
|
||||||
ctx->bearer_path);
|
|
||||||
handle_delete_bearer_context_free (ctx);
|
handle_delete_bearer_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm_obj_info (self, "processing user request to delete bearer '%s'...", ctx->bearer_path);
|
||||||
mm_base_bearer_disconnect (ctx->bearer,
|
mm_base_bearer_disconnect (ctx->bearer,
|
||||||
(GAsyncReadyCallback)delete_bearer_disconnect_ready,
|
(GAsyncReadyCallback)delete_bearer_disconnect_ready,
|
||||||
ctx);
|
ctx);
|
||||||
@@ -1182,7 +1179,7 @@ handle_delete_bearer (MmGdbusModem *skeleton,
|
|||||||
{
|
{
|
||||||
HandleDeleteBearerContext *ctx;
|
HandleDeleteBearerContext *ctx;
|
||||||
|
|
||||||
ctx = g_new (HandleDeleteBearerContext, 1);
|
ctx = g_slice_new0 (HandleDeleteBearerContext);
|
||||||
ctx->skeleton = g_object_ref (skeleton);
|
ctx->skeleton = g_object_ref (skeleton);
|
||||||
ctx->invocation = g_object_ref (invocation);
|
ctx->invocation = g_object_ref (invocation);
|
||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
|
Reference in New Issue
Block a user