[sr-dev] git:master:597242df: http_async_client: init PV API sooner

Camille Oudot camille.oudot at orange.com
Tue Aug 30 11:44:34 CEST 2016


Module: kamailio
Branch: master
Commit: 597242dfbfd883d136aa49d88266fc9edb6b8e09
URL: https://github.com/kamailio/kamailio/commit/597242dfbfd883d136aa49d88266fc9edb6b8e09

Author: Camille Oudot <camille.oudot at orange.com>
Committer: Camille Oudot <camille.oudot at orange.com>
Date: 2016-08-30T11:43:26+02:00

http_async_client: init PV API sooner

fixes #760

---

Modified: modules/http_async_client/http_async_client_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/597242dfbfd883d136aa49d88266fc9edb6b8e09.diff
Patch: https://github.com/kamailio/kamailio/commit/597242dfbfd883d136aa49d88266fc9edb6b8e09.patch

---

diff --git a/modules/http_async_client/http_async_client_mod.c b/modules/http_async_client/http_async_client_mod.c
index 54a0878..74900d0 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
@@ -295,13 +307,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