[sr-dev] git:master:f60a3cfa: jsonrpcc: more debug messages if init fails
Daniel-Constantin Mierla
miconda at gmail.com
Sun Sep 10 11:35:24 CEST 2017
Module: kamailio
Branch: master
Commit: f60a3cfa3070a4782038dcf9f2169562220cc396
URL: https://github.com/kamailio/kamailio/commit/f60a3cfa3070a4782038dcf9f2169562220cc396
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-09-10T10:25:18+02:00
jsonrpcc: more debug messages if init fails
- coherent indentation and whitespacing
---
Modified: src/modules/jsonrpcc/jsonrpcc_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/f60a3cfa3070a4782038dcf9f2169562220cc396.diff
Patch: https://github.com/kamailio/kamailio/commit/f60a3cfa3070a4782038dcf9f2169562220cc396.patch
---
diff --git a/src/modules/jsonrpcc/jsonrpcc_mod.c b/src/modules/jsonrpcc/jsonrpcc_mod.c
index 567fdaf142..903b278447 100644
--- a/src/modules/jsonrpcc/jsonrpcc_mod.c
+++ b/src/modules/jsonrpcc/jsonrpcc_mod.c
@@ -60,7 +60,7 @@ static cmd_export_t cmds[]={
{"jsonrpc_notification", (cmd_function)jsonrpc_notification, 2, fixup_notification, 0, ANY_ROUTE},
{0, 0, 0, 0, 0, 0}
};
-
+
/*
* Script Parameters
@@ -71,23 +71,23 @@ static param_export_t mod_params[]={
{ 0,0,0 }
};
-
+
/*
* Exports
*/
struct module_exports exports = {
- "jsonrpcc", /* module name */
- DEFAULT_DLFLAGS, /* dlopen flags */
- cmds, /* Exported functions */
- mod_params, /* Exported parameters */
- 0, /* exported statistics */
- 0, /* exported MI functions */
- 0, /* exported pseudo-variables */
- 0, /* extra processes */
- mod_init, /* module initialization function */
- 0, /* response function*/
- 0, /* destroy function */
- child_init /* per-child init function */
+ "jsonrpcc", /* module name */
+ DEFAULT_DLFLAGS, /* dlopen flags */
+ cmds, /* Exported functions */
+ mod_params, /* Exported parameters */
+ 0, /* exported statistics */
+ 0, /* exported MI functions */
+ 0, /* exported pseudo-variables */
+ 0, /* extra processes */
+ mod_init, /* module initialization function */
+ 0, /* response function*/
+ 0, /* destroy function */
+ child_init /* per-child init function */
};
@@ -97,12 +97,14 @@ static int mod_init(void) {
/* load the tm functions */
if ( !(load_tm=(load_tm_f)find_export("load_tm", NO_SCRIPT, 0)))
{
- LOG(L_ERR, "ERROR:jsonrpc:mod_init: cannot import load_tm\n");
+ LM_ERR("failed find tm - cannot import load_tm\n");
return -1;
}
/* let the auto-loading function load all TM stuff */
- if (load_tm( &tmb )==-1)
+ if (load_tm( &tmb )==-1) {
+ LM_ERR("failed to bind to tm api\n");
return -1;
+ }
if (servers_param == NULL) {
LM_ERR("servers parameter missing.\n");
@@ -130,8 +132,10 @@ static int child_init(int rank)
return 0;
pid=fork_process(PROC_NOCHLDINIT, "jsonrpc io handler", 1);
- if (pid<0)
+ if (pid<0) {
+ LM_ERR("failed to fork jsonrpc io handler\n");
return -1; /* error */
+ }
if(pid==0){
/* child */
close(pipe_fds[1]);
@@ -144,7 +148,7 @@ static int child_init(int rank)
static int fixup_request(void** param, int param_no)
{
- if (param_no <= 4) {
+ if (param_no <= 4) {
return fixup_spve_null(param, 1);
} else if (param_no == 5) {
return fixup_pvar_null(param, 1);
@@ -155,7 +159,7 @@ static int fixup_request(void** param, int param_no)
static int fixup_notification(void** param, int param_no)
{
- if (param_no <= 2) {
+ if (param_no <= 2) {
return fixup_spve_null(param, 1);
}
LM_ERR("jsonrpc_notification takes exactly 2 parameters.\n");
@@ -164,7 +168,7 @@ static int fixup_notification(void** param, int param_no)
static int fixup_request_free(void** param, int param_no)
{
- if (param_no <= 4) {
+ if (param_no <= 4) {
return 0;
} else if (param_no == 5) {
return fixup_free_pvar_null(param, 1);
More information about the sr-dev
mailing list