summaryrefslogtreecommitdiff
path: root/src/syncevo/ForkExec.h
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-05-13 08:06:01 -0700
committerPatrick Ohly <patrick.ohly@intel.com>2013-05-13 17:49:49 +0200
commit65caef7ee6bbb7d99e700f981b5e2f34a9a5a38e (patch)
treece8dcc731f78147499f0635382626c0d0d86baad /src/syncevo/ForkExec.h
parent5bafef3957bc32a2deb5a917c7773fcd92e8b953 (diff)
D-Bus: fix syncevo-dbus-server<->syncevo-dbus-helper communication when using GIO D-Bus
D-Bus objects in a process exist independently from a specific D-Bus connection. They are only identified by their path. When syncevo-dbus-server forked multiple syncevo-dbus-helper instances, it indirectly (in ForkExec) created multiple callback objects for the childs "watch" functionality (a pending method call that the parent never replies to). These method calls were associated with the a random (oldest?) session instead of the current one. This causes problems once an older session terminates and the callback object destructs, because then the wrong children get a failure response, which they treat as "connection lost = parent has terminated". Found while trying to fix shutdown race conditions. The solution is to generate a unique counter for each child and communicate that counter to the child via a new env variable.
Diffstat (limited to 'src/syncevo/ForkExec.h')
-rw-r--r--src/syncevo/ForkExec.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/syncevo/ForkExec.h b/src/syncevo/ForkExec.h
index 5de1848c..e460e59d 100644
--- a/src/syncevo/ForkExec.h
+++ b/src/syncevo/ForkExec.h
@@ -100,8 +100,16 @@ class ForkExec : private boost::noncopyable {
typedef boost::signals2::signal<void (SyncMLStatus, const std::string &)> OnFailure;
OnFailure m_onFailure;
+ /**
+ * A unique string for the ForkExecParent/Child pair which can be used
+ * as D-Bus path component.
+ */
+ std::string getInstance() const { return m_instance; }
+
protected:
ForkExec();
+
+ std::string m_instance;
};
/**