]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
call on_load and on_unload methods
authorMoises Silva <moy@sangoma.com>
Thu, 19 Nov 2009 20:10:34 +0000 (20:10 +0000)
committerMoises Silva <moy@sangoma.com>
Thu, 19 Nov 2009 20:10:34 +0000 (20:10 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@886 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c
libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_interface.h

index 0ede9ce653324ba2d15732205940043067d5d0a1..9ae91de014b749111250ba119b2a63d47604bcfe 100644 (file)
@@ -1376,7 +1376,12 @@ static ZIO_SIG_UNLOAD_FUNCTION(zap_sangoma_boost_destroy)
                hashtable_this(i, &key, NULL, &val);
                if (key && val) {
                        sigmod = val;
-                       zap_dso_destroy(sigmod->pvt);
+                       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);
+                       }
                }
        }
 
@@ -1641,6 +1646,10 @@ static ZIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(zap_sangoma_boost_configure_span)
 
                        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->set_write_msg_cb(zap_boost_write_msg);
                sigmod_iface->set_sig_status_cb(zap_boost_sig_status_change);
index adc786d3d253c5a9b513b1baa9be5956088c0549..bcd21849910bb45b84f8b520d0fd6181e7bf2f8d 100644 (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
+  \return ZAP_SUCCESS or ZAP_FAIL
  */
 #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 
 
 /*! 
   \brief Called when the module is being unloaded, last chance to stop everything!
  */
 #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 
 
 /*!