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).
This commit is contained in:
Patrick Ohly 2014-04-10 06:08:13 -07:00
parent 02088c22e0
commit 58fa67f76d
2 changed files with 5 additions and 4 deletions

View file

@ -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<SyncEvo::GLibNotify> notify(new GLibNotify(file.c_str(), boost::bind(&Server::fileModified, this)));
boost::shared_ptr<SyncEvo::GLibNotify> notify(new GLibNotify(file.c_str(), boost::bind(&Server::fileModified, this, file)));
m_files.push_back(notify);
} catch (...) {
// ignore errors for indidividual files

View file

@ -93,7 +93,7 @@ class Server : public GDBusCXX::DBusObjectHelper
* automatic syncing enabled in a config.
*/
list< boost::shared_ptr<GLibNotify> > m_files;
void fileModified();
void fileModified(const std::string &file);
bool shutdown();
/**