From 14a0ffe23be6437c9ee656ccf2d516ead6265dfd Mon Sep 17 00:00:00 2001 From: Oliver Kurth Date: Mon, 26 Feb 2018 19:23:18 -0800 Subject: [PATCH] Enhancing CAF listener preconfigured check logic to update the preconfigured flag at runtime 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. --- .../Subsystems/MaIntegration/src/CMonitorListener.cpp | 9 +++++++-- .../Subsystems/MaIntegration/src/CMonitorListener.h | 4 +--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp index cc5a63f0f..6d7473c58 100644 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp +++ b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp @@ -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; +} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h index e8899f55a..d5f64a806 100644 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h +++ b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h @@ -23,9 +23,7 @@ public: bool preConfigureListener(); - bool isListenerPreConfigured() { - return _listenerPreConfigured; - } + bool isListenerPreConfigured(); bool followTunnel(std::string& listenerStartupType); -- 2.47.3