]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Enhancing CAF listener preconfigured check logic to update the preconfigured flag...
authorOliver Kurth <okurth@vmware.com>
Tue, 27 Feb 2018 03:23:18 +0000 (19:23 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 27 Feb 2018 03:23:18 +0000 (19:23 -0800)
1. Preconfigure listener and start listener upon tunnel enabled logic are
   invoked in two different threads.
2. There is a case where preconfigure logic is performed after the
   pre-configured flag is computed in the enable-listener thread.

The current patch invalidates the flag in the start listener thread and
should guarantee the preconfigured status is up-to-date.

open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp
open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h

index cc5a63f0f18411041940c41d3c1e365cc5f7823a..6d7473c58f8fecd0ce9f15ec8e722509412b512c 100644 (file)
@@ -189,6 +189,11 @@ void CMonitorListener::listenerPreConfigured(
    FileSystemUtils::saveTextFile(_listenerPreConfiguredPath, reason);
 }
 
-
-
+bool CMonitorListener::isListenerPreConfigured() {
+   // Invalidate the flag
+   if (!_listenerPreConfigured) {
+      _listenerPreConfigured = FileSystemUtils::doesFileExist(_listenerPreConfiguredPath);
+   }
+   return _listenerPreConfigured;
+}
 
index e8899f55ade72f53c75816008edacc9493c663f2..d5f64a806a2fadd39581052a8d5184b7c6ae2d32 100644 (file)
@@ -23,9 +23,7 @@ public:
 
    bool preConfigureListener();
 
-   bool isListenerPreConfigured() {
-      return _listenerPreConfigured;
-   }
+   bool isListenerPreConfigured();
 
    bool followTunnel(std::string& listenerStartupType);