From: Arvin Schnell Date: Thu, 26 Sep 2024 16:30:24 +0000 (+0200) Subject: - extended debug output X-Git-Tag: v0.12.0~31^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F935%2Fhead;p=thirdparty%2Fsnapper.git - extended debug output --- diff --git a/server/Client.cc b/server/Client.cc index 3ecda0e1..c1987350 100644 --- a/server/Client.cc +++ b/server/Client.cc @@ -1828,6 +1828,8 @@ Client::debug(DBus::Connection& conn, DBus::Message& msg) if (it->is_loaded()) { s << ", loaded"; + if (it->is_locked(clients)) + s << ", locked"; if (it->use_count() == 0) s << ", unused for " << duration_cast(it->unused_for()).count() << "ms"; else diff --git a/server/MetaSnapper.cc b/server/MetaSnapper.cc index e0f090bc..2c50ae53 100644 --- a/server/MetaSnapper.cc +++ b/server/MetaSnapper.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2012-2015] Novell, Inc. - * Copyright (c) [2018-2023] SUSE LLC + * Copyright (c) [2018-2024] SUSE LLC * * All Rights Reserved. * @@ -30,6 +30,7 @@ #include #include "MetaSnapper.h" +#include "Client.h" MetaSnappers meta_snappers; @@ -129,6 +130,17 @@ MetaSnapper::unload() } +bool +MetaSnapper::is_locked(const Clients& clients) const +{ + for (const Client& client : clients) + if (client.has_lock(configName())) + return true; + + return false; +} + + MetaSnappers::MetaSnappers() { } diff --git a/server/MetaSnapper.h b/server/MetaSnapper.h index a630295e..1111aad5 100644 --- a/server/MetaSnapper.h +++ b/server/MetaSnapper.h @@ -1,6 +1,6 @@ /* * Copyright (c) [2012-2015] Novell, Inc. - * Copyright (c) [2018-2023] SUSE LLC + * Copyright (c) [2018-2024] SUSE LLC * * All Rights Reserved. * @@ -36,6 +36,9 @@ using namespace std; using namespace snapper; +class Clients; + + struct UnknownConfig : public Exception { explicit UnknownConfig() : Exception("unknown config") {} @@ -65,6 +68,8 @@ public: bool is_loaded() const { return snapper; } void unload(); + bool is_locked(const Clients& clients) const; + private: void set_permissions();