Skip to content

Commit

Permalink
http_async_client: init PV API sooner
Browse files Browse the repository at this point in the history
fixes #760
  • Loading branch information
camilleoudot committed Aug 30, 2016
1 parent 46c59ce commit 597242d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions modules/http_async_client/http_async_client_mod.c
Expand Up @@ -54,6 +54,7 @@
#include "../../modules/tm/tm_load.h"
#include "../../modules/pv/pv_api.h"


#include "async_http.h"

MODULE_VERSION
Expand Down Expand Up @@ -227,14 +228,25 @@ 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
*/
static int mod_init(void)
{
unsigned int n;
pv_register_api_t pvra;
LM_INFO("Initializing Http Async module\n");

#ifdef STATISTICS
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 597242d

Please sign in to comment.