[Asterisk-code-review] res crypto: Perform cleanup at shutdown. (asterisk[13])

Corey Farrell asteriskteam at digium.com
Sat Jan 9 13:39:00 CST 2016


Corey Farrell has uploaded a new change for review.

  https://gerrit.asterisk.org/1968

Change subject: res_crypto: Perform cleanup at shutdown.
......................................................................

res_crypto: Perform cleanup at shutdown.

This change causes res_crypto to unregister CLI at shutdown while still
preventing the module from being unloaded.

ASTERISK-25673 #close

Change-Id: Ie5d57338dc2752abfc0dd05d0eec86413f2304fc
---
M res/res_crypto.c
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/1968/1

diff --git a/res/res_crypto.c b/res/res_crypto.c
index 78b8df2..1683427 100644
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -652,13 +652,17 @@
 	} else {
 		crypto_load(-1, -1);
 	}
+
+	/* This prevents dlclose from ever running, but allows CLI cleanup at shutdown. */
+	ast_module_shutdown_ref(ast_module_info->self);
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	/* Can't unload this once we're loaded */
-	return -1;
+	ast_cli_unregister_multiple(cli_crypto, ARRAY_LEN(cli_crypto));
+
+	return 0;
 }
 
 /* needs usecount semantics defined */

-- 
To view, visit https://gerrit.asterisk.org/1968
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5d57338dc2752abfc0dd05d0eec86413f2304fc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>



More information about the asterisk-code-review mailing list