Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/next' into OpenMAMA-6.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fquinner committed Jun 21, 2018
2 parents 8e7f91d + 0f792ba commit 9df5fce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
6 changes: 6 additions & 0 deletions mama/c_cpp/src/c/dqstrategyplugin/dqstrategyplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ dqstrategyMamaPlugin_subscriptionDestroyHook(mamaPluginInfo pluginInfo,

strategy = mamaSubscription_getDqStrategy(subscription);

/* basic subscriptions will not have a dqStrategy */
if (NULL == strategy)
{
return MAMA_STATUS_OK;
}

if (MAMA_STATUS_OK == dqStrategy_destroy(strategy))
{
return MAMA_STATUS_OK;
Expand Down
28 changes: 18 additions & 10 deletions mama/c_cpp/src/c/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

#define MAX_FUNC_STRING 256

int gNumPlugins = 0;
int gCurrentPluginSize = INITIAL_PLUGIN_ARRAY_SIZE;
/**
* @brief Mechanism for registering required plugin functions.
Expand Down Expand Up @@ -193,6 +192,11 @@ mama_initPlugins(void)
gPlugins = calloc (INITIAL_PLUGIN_ARRAY_SIZE, sizeof(mamaPluginImpl*));
}

if (gPlugins == NULL)
{
return MAMA_STATUS_NOMEM;
}

properties_ForEach (mamaInternal_getProperties(), pluginPropertiesCb, NULL);

#ifdef WITH_ENTERPRISE
Expand Down Expand Up @@ -305,6 +309,18 @@ mama_loadPlugin (const char* pluginName)
return status;
}

/* Resize the gPlugins array for the new plugin */
if((gPluginNo + 1) > gCurrentPluginSize)
{
gCurrentPluginSize += 1;
gPlugins = (mamaPluginImpl**) realloc (gPlugins, sizeof(mamaPluginImpl*) * gCurrentPluginSize);

if (gPlugins == NULL)
{
return MAMA_STATUS_NOMEM;
}
}

/* Save off the plugin impl and increment the plugin counter */
gPlugins[gPluginNo] = aPluginImpl;
gPluginNo++;
Expand Down Expand Up @@ -511,7 +527,7 @@ mamaPlugin_fireSubscriptionDestroyHook (mamaSubscription subscription)
{
if (gPlugins[plugin] != NULL)
{
if (gPlugins[plugin]->mamaPluginSubscriptionPreMsgHook != NULL)
if (gPlugins[plugin]->mamaPluginSubscriptionDestroyHook != NULL)
{
status = gPlugins[plugin]->mamaPluginSubscriptionDestroyHook (gPlugins[plugin]->mPluginInfo, subscription);

Expand Down Expand Up @@ -579,16 +595,8 @@ static void pluginPropertiesCb(const char* name, const char* value, void* closur
{
if(strstr(name, PLUGIN_PROPERTY) != NULL)
{
gNumPlugins++;
if(gNumPlugins > gCurrentPluginSize)
{
gCurrentPluginSize *= 2;
gPlugins = (mamaPluginImpl**) realloc (gPlugins, sizeof(mamaPluginImpl*) * gCurrentPluginSize);
}

mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising %s", value);
mama_loadPlugin (value);

}
}
}

0 comments on commit 9df5fce

Please sign in to comment.