From: Oliver Kurth Date: Mon, 4 May 2020 18:54:13 +0000 (-0700) Subject: [AppInfo] Tweak the gather loop only for a real config reload. X-Git-Tag: stable-11.2.0~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e5fd5d7976d9d047229b33f9a209c250f928384;p=thirdparty%2Fopen-vm-tools.git [AppInfo] Tweak the gather loop only for a real config reload. The poll loop for the appInfo is being tweaked (destroyed and recreated) for every conf reload even when nothing related to appinfo changed. This may cause few scenarios where the 'application information' will never be collected inside the guest. Fixed the code, to tweak the loop only when there is a real appinfo related config change in the tools.conf file. --- diff --git a/open-vm-tools/services/plugins/appInfo/appInfo.c b/open-vm-tools/services/plugins/appInfo/appInfo.c index d96d9a075..4e64799b6 100644 --- a/open-vm-tools/services/plugins/appInfo/appInfo.c +++ b/open-vm-tools/services/plugins/appInfo/appInfo.c @@ -93,7 +93,7 @@ static guint gAppInfoPollInterval = 0; */ static GSource *gAppInfoTimeoutSource = NULL; -static void TweakGatherLoop(ToolsAppCtx *ctx); +static void TweakGatherLoop(ToolsAppCtx *ctx, gboolean force); /* @@ -415,7 +415,7 @@ AppInfoGather(gpointer data) // IN "information\n", __FUNCTION__); } - TweakGatherLoop(ctx); + TweakGatherLoop(ctx, TRUE); return G_SOURCE_REMOVE; } @@ -483,12 +483,16 @@ TweakGatherLoopEx(ToolsAppCtx *ctx, // IN * AppInfo Gather loop timeout source. * * @param[in] ctx The application context. + * @param[in] force If set to TRUE, the poll loop will be + * tweaked even if the poll interval hasn't + * changed from the previous value. * ***************************************************************************** */ static void -TweakGatherLoop(ToolsAppCtx *ctx) // IN +TweakGatherLoop(ToolsAppCtx *ctx, // IN + gboolean force) // IN { gboolean disabled = VMTools_ConfigGetBoolean(ctx->config, @@ -511,11 +515,13 @@ TweakGatherLoop(ToolsAppCtx *ctx) // IN } } - /* - * pollInterval can never be a negative value. Typecasting into - * guint should not be a problem. - */ - TweakGatherLoopEx(ctx, (guint) pollInterval); + if (force || (gAppInfoPollInterval != pollInterval)) { + /* + * pollInterval can never be a negative value. Typecasting into + * guint should not be a problem. + */ + TweakGatherLoopEx(ctx, (guint) pollInterval); + } } @@ -539,7 +545,7 @@ AppInfoServerConfReload(gpointer src, // IN { g_info("%s: Reloading the tools configuration.\n", __FUNCTION__); - TweakGatherLoop(ctx); + TweakGatherLoop(ctx, FALSE); } @@ -692,7 +698,7 @@ ToolsOnLoad(ToolsAppCtx *ctx) // IN /* * Set up the AppInfo gather loop. */ - TweakGatherLoop(ctx); + TweakGatherLoop(ctx, TRUE); return ®Data; }