From 58fa67f76dec16ac936cb6cf3b0f13fc2ba00f2c Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 10 Apr 2014 06:08:13 -0700 Subject: [PATCH] D-Bus server: enhance logging of file modification Include the name of the file which got modified. This helped track down why the server sometimes shut down unexpectedly during parallel testing (main executable was renamed by D-Bus testing). --- src/dbus/server/server.cpp | 7 ++++--- src/dbus/server/server.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dbus/server/server.cpp b/src/dbus/server/server.cpp index 7f394448..e600dbf2 100644 --- a/src/dbus/server/server.cpp +++ b/src/dbus/server/server.cpp @@ -480,9 +480,10 @@ bool Server::shutdown() return false; } -void Server::fileModified() +void Server::fileModified(const std::string &file) { - SE_LOG_DEBUG(NULL, "file modified, %s shutdown: %s, %s", + SE_LOG_DEBUG(NULL, "file %s modified, %s shutdown: %s, %s", + file.c_str(), m_shutdownRequested ? "continuing" : "initiating", m_shutdownTimer ? "timer already active" : "timer not yet active", m_activeSession ? "waiting for active session to finish" : "setting timer"); @@ -521,7 +522,7 @@ void Server::run() BOOST_FOREACH(const string &file, files) { try { SE_LOG_DEBUG(NULL, "watching: %s", file.c_str()); - boost::shared_ptr notify(new GLibNotify(file.c_str(), boost::bind(&Server::fileModified, this))); + boost::shared_ptr notify(new GLibNotify(file.c_str(), boost::bind(&Server::fileModified, this, file))); m_files.push_back(notify); } catch (...) { // ignore errors for indidividual files diff --git a/src/dbus/server/server.h b/src/dbus/server/server.h index d23c5b42..9b55c212 100644 --- a/src/dbus/server/server.h +++ b/src/dbus/server/server.h @@ -93,7 +93,7 @@ class Server : public GDBusCXX::DBusObjectHelper * automatic syncing enabled in a config. */ list< boost::shared_ptr > m_files; - void fileModified(); + void fileModified(const std::string &file); bool shutdown(); /**