Преглед на файлове

http_async_client: init PV API sooner

fixes #760
Camille Oudot преди 9 години
родител
ревизия
597242dfbf
променени са 1 файла, в които са добавени 13 реда и са изтрити 8 реда
  1. 13 8
      modules/http_async_client/http_async_client_mod.c

+ 13 - 8
modules/http_async_client/http_async_client_mod.c

@@ -54,6 +54,7 @@
 #include "../../modules/tm/tm_load.h"
 #include "../../modules/tm/tm_load.h"
 #include "../../modules/pv/pv_api.h"
 #include "../../modules/pv/pv_api.h"
 
 
+
 #include "async_http.h"
 #include "async_http.h"
 
 
 MODULE_VERSION
 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
  * init module function
@@ -234,7 +247,6 @@ struct module_exports exports = {
 static int mod_init(void)
 static int mod_init(void)
 {
 {
 	unsigned int n;
 	unsigned int n;
-	pv_register_api_t pvra;
 	LM_INFO("Initializing Http Async module\n");
 	LM_INFO("Initializing Http Async module\n");
 
 
 #ifdef STATISTICS
 #ifdef STATISTICS
@@ -295,13 +307,6 @@ static int mod_init(void)
 		memset(&tmb, 0, sizeof(tm_api_t));
 		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 */
 	/* allocate workers array */
 	workers = shm_malloc(num_workers * sizeof(*workers));
 	workers = shm_malloc(num_workers * sizeof(*workers));
 	if(workers == NULL) {
 	if(workers == NULL) {