call on_load and on_unload methods

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@886 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2009-11-19 20:10:34 +00:00
parent f1f126b5d5
commit c9223883dc
2 changed files with 13 additions and 3 deletions

View File

@ -1376,9 +1376,14 @@ static ZIO_SIG_UNLOAD_FUNCTION(zap_sangoma_boost_destroy)
hashtable_this(i, &key, NULL, &val); hashtable_this(i, &key, NULL, &val);
if (key && val) { if (key && val) {
sigmod = val; sigmod = val;
if (sigmod->on_unload() != ZAP_SUCCESS) {
zap_log(ZAP_LOG_ERROR, "Failed to unload boost signaling module object\n");
/* hope for the best */
} else {
zap_dso_destroy(sigmod->pvt); zap_dso_destroy(sigmod->pvt);
} }
} }
}
hashtable_destroy(g_boost_modules_hash); hashtable_destroy(g_boost_modules_hash);
zap_mutex_destroy(&request_mutex); zap_mutex_destroy(&request_mutex);
@ -1641,6 +1646,10 @@ static ZIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(zap_sangoma_boost_configure_span)
FAIL_CONFIG_RETURN(ZAP_FAIL); FAIL_CONFIG_RETURN(ZAP_FAIL);
} }
if (sigmod_iface->on_load() != ZAP_SUCCESS) {
zap_log(ZAP_LOG_ERROR, "Failed to load Sangoma boost signaling module interface '%s': on_load method failed\n", path);
FAIL_CONFIG_RETURN(ZAP_FAIL);
}
sigmod_iface->pvt = lib; sigmod_iface->pvt = lib;
sigmod_iface->set_write_msg_cb(zap_boost_write_msg); sigmod_iface->set_write_msg_cb(zap_boost_write_msg);
sigmod_iface->set_sig_status_cb(zap_boost_sig_status_change); sigmod_iface->set_sig_status_cb(zap_boost_sig_status_change);

View File

@ -143,16 +143,17 @@ typedef zap_status_t (*boost_stop_span_func_t) BOOST_START_SPAN_ARGS;
/*! /*!
\brief Called when the module is being loaded BEFORE calling anything else \brief Called when the module is being loaded BEFORE calling anything else
\return ZAP_SUCCESS or ZAP_FAIL
*/ */
#define BOOST_ON_LOAD_ARGS (void) #define BOOST_ON_LOAD_ARGS (void)
typedef void (*boost_on_load_func_t) BOOST_ON_LOAD_ARGS; typedef zap_status_t (*boost_on_load_func_t) BOOST_ON_LOAD_ARGS;
#define BOOST_ON_LOAD_FUNCTION(name) void name BOOST_ON_LOAD_ARGS #define BOOST_ON_LOAD_FUNCTION(name) void name BOOST_ON_LOAD_ARGS
/*! /*!
\brief Called when the module is being unloaded, last chance to stop everything! \brief Called when the module is being unloaded, last chance to stop everything!
*/ */
#define BOOST_ON_UNLOAD_ARGS (void) #define BOOST_ON_UNLOAD_ARGS (void)
typedef void (*boost_on_unload_func_t) BOOST_ON_UNLOAD_ARGS; typedef zap_status_t (*boost_on_unload_func_t) BOOST_ON_UNLOAD_ARGS;
#define BOOST_ON_UNLOAD_FUNCTION(name) void name BOOST_ON_UNLOAD_ARGS #define BOOST_ON_UNLOAD_FUNCTION(name) void name BOOST_ON_UNLOAD_ARGS
/*! /*!