mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Prevent unload of modules which implement an Optional API.
Once an Optional API module is loaded it should stay loaded. Unloading an optional API module runs the risk of a crash if something else is using it. This patch causes all optional API providers to tell the module loader not to unload except at shutdown. ASTERISK-27389 Change-Id: Ia07786fe655681aec49cc8d3d96e06483b11f5e6
This commit is contained in:
		| @@ -4715,6 +4715,10 @@ static int load_module(void) | ||||
| 		unload_module(); | ||||
| 		return AST_MODULE_LOAD_DECLINE; | ||||
| 	} | ||||
|  | ||||
| 	/* For Optional API. */ | ||||
| 	ast_module_shutdown_ref(ast_module_info->self); | ||||
|  | ||||
| 	return AST_MODULE_LOAD_SUCCESS; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1439,6 +1439,9 @@ static int load_module(void) | ||||
| 	ast_http_uri_link(&websocketuri); | ||||
| 	websocket_add_protocol_internal("echo", websocket_echo_callback); | ||||
|  | ||||
| 	/* For Optional API. */ | ||||
| 	ast_module_shutdown_ref(ast_module_info->self); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -987,6 +987,9 @@ static int load_module(void) | ||||
| 	ast_manager_register_xml("PauseMonitor", EVENT_FLAG_CALL, pause_monitor_action); | ||||
| 	ast_manager_register_xml("UnpauseMonitor", EVENT_FLAG_CALL, unpause_monitor_action); | ||||
|  | ||||
| 	/* For Optional API. */ | ||||
| 	ast_module_shutdown_ref(ast_module_info->self); | ||||
|  | ||||
| 	return AST_MODULE_LOAD_SUCCESS; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1474,6 +1474,10 @@ static int load_module(void) | ||||
| 	} | ||||
| 	ast_cli_register_multiple(cli_pktccops, sizeof(cli_pktccops) / sizeof(struct ast_cli_entry)); | ||||
| 	restart_pktc_thread(); | ||||
|  | ||||
| 	/* For Optional API. */ | ||||
| 	ast_module_shutdown_ref(ast_module_info->self); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1407,6 +1407,10 @@ static int _unload_module(int fromload) | ||||
| 	} | ||||
|  | ||||
| 	smdi_loaded = 0; | ||||
|  | ||||
| 	/* For Optional API. */ | ||||
| 	ast_module_shutdown_ref(ast_module_info->self); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -355,6 +355,9 @@ static int load_module(void) | ||||
| 		return AST_MODULE_LOAD_DECLINE; | ||||
| 	} | ||||
|  | ||||
| 	/* For Optional API. */ | ||||
| 	ast_module_shutdown_ref(ast_module_info->self); | ||||
|  | ||||
| 	return AST_MODULE_LOAD_SUCCESS; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user