[sr-dev] git:4.4:7164e5d3: http_async_client: init PV API sooner

Camille Oudot camille.oudot at orange.com
Wed Aug 31 12:12:58 CEST 2016


Module: kamailio
Branch: 4.4
Commit: 7164e5d3d587149e03c7ad69feb3e9139ac30757
URL: https://github.com/kamailio/kamailio/commit/7164e5d3d587149e03c7ad69feb3e9139ac30757

Author: Camille Oudot <camille.oudot at orange.com>
Committer: Camille Oudot <camille.oudot at orange.com>
Date: 2016-08-31T12:12:42+02:00

http_async_client: init PV API sooner

fixes #760

(cherry picked from commit 597242dfbfd883d136aa49d88266fc9edb6b8e09)

---

Modified: modules/http_async_client/http_async_client_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7164e5d3d587149e03c7ad69feb3e9139ac30757.diff
Patch: https://github.com/kamailio/kamailio/commit/7164e5d3d587149e03c7ad69feb3e9139ac30757.patch

---

diff --git a/modules/http_async_client/http_async_client_mod.c b/modules/http_async_client/http_async_client_mod.c
index 965129d..ddbd882 100644
--- a/modules/http_async_client/http_async_client_mod.c
+++ b/modules/http_async_client/http_async_client_mod.c
@@ -54,6 +54,7 @@
 #include "../../modules/tm/tm_load.h"
 #include "../../modules/pv/pv_api.h"
 
+
 #include "async_http.h"
 
 MODULE_VERSION
@@ -227,6 +228,18 @@ struct module_exports exports = {
 };
 
 
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+	pv_register_api_t pvra;
+
+	pvra = (pv_register_api_t)find_export("pv_register_api", NO_SCRIPT, 0);
+	if (!pvra) {
+		LM_ERR("Cannot import pv functions (pv module must be loaded before this module)\n");
+		return -1;
+	}
+	pvra(&pv_api);
+	return 0;
+}
 
 /**
  * init module function
@@ -234,7 +247,6 @@ struct module_exports exports = {
 static int mod_init(void)
 {
 	unsigned int n;
-	pv_register_api_t pvra;
 	LM_INFO("Initializing Http Async module\n");
 
 #ifdef STATISTICS
@@ -304,13 +316,6 @@ static int mod_init(void)
 		memset(&tmb, 0, sizeof(tm_api_t));
 	}
 
-	pvra = (pv_register_api_t)find_export("pv_register_api", NO_SCRIPT, 0);
-	if (!pvra) {
-		LM_ERR("Cannot import pv functions (pv module must be loaded before this module)\n");
-		return -1;
-	}
-	pvra(&pv_api);
-
 	/* allocate workers array */
 	workers = shm_malloc(num_workers * sizeof(*workers));
 	if(workers == NULL) {




More information about the sr-dev mailing list