[asterisk-commits] res crypto: Perform cleanup at shutdown. (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 11 16:35:23 CST 2016


Joshua Colp has submitted this change and it was merged.

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(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_crypto.c b/res/res_crypto.c
index 2f0c676..71604aa 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/1967
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5d57338dc2752abfc0dd05d0eec86413f2304fc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-commits mailing list