Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- extended debug output #935

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions server/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<milliseconds>(it->unused_for()).count() << "ms";
else
Expand Down
14 changes: 13 additions & 1 deletion server/MetaSnapper.cc
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -30,6 +30,7 @@
#include <snapper/SnapperDefines.h>

#include "MetaSnapper.h"
#include "Client.h"


MetaSnappers meta_snappers;
Expand Down Expand Up @@ -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()
{
}
Expand Down
7 changes: 6 additions & 1 deletion server/MetaSnapper.h
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -36,6 +36,9 @@ using namespace std;
using namespace snapper;


class Clients;


struct UnknownConfig : public Exception
{
explicit UnknownConfig() : Exception("unknown config") {}
Expand Down Expand Up @@ -65,6 +68,8 @@ class MetaSnapper : public RefCounter
bool is_loaded() const { return snapper; }
void unload();

bool is_locked(const Clients& clients) const;

private:

void set_permissions();
Expand Down
Loading