abort if one of the IMCs or IMVs fail to initialize

This commit is contained in:
Andreas Steffen
2010-11-09 20:43:51 +01:00
parent 8126344264
commit c228ad607c
5 changed files with 38 additions and 18 deletions
@@ -90,11 +90,12 @@ METHOD(imc_manager_t, remove_, imc_t*,
}
}
enumerator->destroy(enumerator);
return NULL;
}
METHOD(imc_manager_t, notify_connection_change, void,
private_tnc_imc_manager_t *this, TNC_ConnectionID id,
TNC_ConnectionState state)
TNC_ConnectionState state)
{
enumerator_t *enumerator;
imc_t *imc;
@@ -208,8 +209,5 @@ imc_manager_t* tnc_imc_manager_create(void)
.next_imc_id = 1,
);
return &this->public;
}
+16 -5
View File
@@ -49,15 +49,26 @@ plugin_t *tnc_imc_plugin_create()
/* Create IMC manager */
charon->imcs = tnc_imc_manager_create();
/* Create and register IMCs */
name = "Dummy";
filename = "/usr/local/lib/libdummyimc.so";
imc = tnc_imc_create(name, filename);
if (imc)
/**
* Create, register and initialize IMCs
* Abort if one of the IMCs fails to initialize successfully
*/
{
name = "Dummy";
filename = "/usr/local/lib/libdummyimc.so";
imc = tnc_imc_create(name, filename);
if (!imc)
{
charon->imcs->destroy(charon->imcs);
free(this);
return NULL;
}
if (!charon->imcs->add(charon->imcs, imc))
{
imc->destroy(imc);
charon->imcs->destroy(charon->imcs);
free(this);
return NULL;
}
}
return &this->plugin;