Skip to content

Commit

Permalink
Merge pull request #935 from aschnell/master
Browse files Browse the repository at this point in the history
- extended debug output
  • Loading branch information
aschnell authored Sep 26, 2024
2 parents d95f599 + e6ffce8 commit e4bf1b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
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

0 comments on commit e4bf1b7

Please sign in to comment.