]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)
authorGeorge Joseph <gjoseph@digium.com>
Wed, 12 Apr 2017 12:47:59 +0000 (06:47 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 12 Apr 2017 21:53:48 +0000 (16:53 -0500)
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e

formats/format_ogg_speex.c
res/res_ari_events.c
res/res_http_media_cache.c
rest-api-templates/res_ari_resource.c.mustache
tests/test_media_cache.c

index 6152e9c52ec67c9d1b09f313bbfaf35155c7a576..52ac7cf387008272f8d9d50e6d9f9390eccfc9f3 100644 (file)
@@ -314,6 +314,15 @@ static struct ast_format_def speex32_f = {
        .desc_size = sizeof(struct speex_desc),
 };
 
+static int unload_module(void)
+{
+       int res = 0;
+       res |= ast_format_def_unregister(speex_f.name);
+       res |= ast_format_def_unregister(speex16_f.name);
+       res |= ast_format_def_unregister(speex32_f.name);
+       return res;
+}
+
 static int load_module(void)
 {
        speex_f.format = ast_format_speex;
@@ -323,21 +332,13 @@ static int load_module(void)
        if (ast_format_def_register(&speex_f) ||
            ast_format_def_register(&speex16_f) ||
            ast_format_def_register(&speex32_f)) {
-               return AST_MODULE_LOAD_FAILURE;
+               unload_module();
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        return AST_MODULE_LOAD_SUCCESS;
 }
 
-static int unload_module(void)
-{
-       int res = 0;
-       res |= ast_format_def_unregister(speex_f.name);
-       res |= ast_format_def_unregister(speex16_f.name);
-       res |= ast_format_def_unregister(speex32_f.name);
-       return res;
-}
-
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "OGG/Speex audio",
        .load = load_module,
        .unload = unload_module,
index f6817b1a39afad3b12935ac1b32a1b967499045d..832708f4d8d293de90f2980f8f9fb2fa7bfd4f55 100644 (file)
@@ -424,6 +424,7 @@ static int unload_module(void)
        ast_ari_remove_handler(&events);
        ao2_cleanup(events.ws_server);
        events.ws_server = NULL;
+       ast_ari_websocket_events_event_websocket_dtor();
        stasis_app_unref();
        return 0;
 }
@@ -434,11 +435,12 @@ static int load_module(void)
        struct ast_websocket_protocol *protocol;
 
        if (ast_ari_websocket_events_event_websocket_init() == -1) {
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        events.ws_server = ast_websocket_server_create();
        if (!events.ws_server) {
+               ast_ari_websocket_events_event_websocket_dtor();
                return AST_MODULE_LOAD_DECLINE;
        }
 
@@ -446,6 +448,7 @@ static int load_module(void)
        if (!protocol) {
                ao2_ref(events.ws_server, -1);
                events.ws_server = NULL;
+               ast_ari_websocket_events_event_websocket_dtor();
                return AST_MODULE_LOAD_DECLINE;
        }
        protocol->session_attempted = ast_ari_events_event_websocket_ws_attempted_cb;
index 2207b96ddd4c4fe73e93cd815cf2c3649c12d5e3..991abfb965542da14d693c249cc45cd257407139 100644 (file)
@@ -427,13 +427,13 @@ static int load_module(void)
        if (ast_bucket_scheme_register("http", &http_bucket_wizard, &http_bucket_file_wizard,
                        NULL, NULL)) {
                ast_log(LOG_ERROR, "Failed to register Bucket HTTP wizard scheme implementation\n");
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        if (ast_bucket_scheme_register("https", &https_bucket_wizard, &https_bucket_file_wizard,
                        NULL, NULL)) {
                ast_log(LOG_ERROR, "Failed to register Bucket HTTPS wizard scheme implementation\n");
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        return AST_MODULE_LOAD_SUCCESS;
index f58adcd9ee08714c7a457152e27ca9e392b180db..883f1fdca64dd52e7252bf49c251e134691f1b1a 100644 (file)
@@ -265,6 +265,7 @@ static int unload_module(void)
 {{#has_websocket}}
        ao2_cleanup({{full_name}}.ws_server);
        {{full_name}}.ws_server = NULL;
+       ast_ari_websocket_events_event_websocket_dtor();
 {{/has_websocket}}
 {{/apis}}
        stasis_app_unref();
@@ -280,11 +281,12 @@ static int load_module(void)
        struct ast_websocket_protocol *protocol;
 
        if (ast_ari_websocket_{{c_name}}_{{c_nickname}}_init() == -1) {
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        {{full_name}}.ws_server = ast_websocket_server_create();
        if (!{{full_name}}.ws_server) {
+               ast_ari_websocket_events_event_websocket_dtor();
                return AST_MODULE_LOAD_DECLINE;
        }
 
@@ -292,6 +294,7 @@ static int load_module(void)
        if (!protocol) {
                ao2_ref({{full_name}}.ws_server, -1);
                {{full_name}}.ws_server = NULL;
+               ast_ari_websocket_events_event_websocket_dtor();
                return AST_MODULE_LOAD_DECLINE;
        }
        protocol->session_attempted = ast_ari_{{c_name}}_{{c_nickname}}_ws_attempted_cb;
index 685693c3645613597b9816ae17e35d1be5000761..ca1e2dd568b79880b8fa505eb45130114e2f64f9 100644 (file)
@@ -399,7 +399,7 @@ static int load_module(void)
        if (ast_bucket_scheme_register("httptest", &bucket_test_wizard,
                &bucket_file_test_wizard, NULL, NULL)) {
                ast_log(LOG_ERROR, "Failed to register Bucket HTTP test wizard scheme implementation\n");
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        AST_TEST_REGISTER(exists_nominal);