Module: sip-router
Branch: master
Commit: 8f2817965f28c05947484023c324866288d7abb1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8f28179…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Tue May 19 18:20:59 2009 +0200
core: PV printing, revert 103ffecf7, add the proper fix from kamailio
revert not needed commit 103ffecf7, add the proper fix from kamailio for this
problem. Now its possible to print and use more then one pseudo-variable at a time.
The old implementation used only one static buffer, so in subsequent calls to the
function the previous printed variable was overwritten.
---
sr_module.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/sr_module.c b/sr_module.c
index 1ab8868..8dfcfad 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -1349,6 +1349,9 @@ int fixup_str_2(void** param, int param_no)
}
+
+#define PV_PRINT_BUF_SIZE 1024
+#define PV_PRINT_BUF_NO 3
/** Get the function parameter value as string.
* @return 0 - Success
* -1 - Cannot get value
@@ -1359,8 +1362,8 @@ int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param)
int ret;
avp_t* avp;
pv_value_t pv_val;
- static char pve_buf[256]; /* ugly hack needed for PVE */
- memset(pve_buf, 0, sizeof(pve_buf));
+ static int buf_itr = 0; /* ugly hack needed for PVE */
+ static char pve_buf[PV_PRINT_BUF_NO][PV_PRINT_BUF_SIZE];
switch(param->type) {
case FPARAM_REGEX:
@@ -1405,13 +1408,14 @@ int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param)
}
break;
case FPARAM_PVE:
- dst->len=sizeof(pve_buf);
- if (unlikely(pv_printf(msg, param->v.pve, pve_buf, &dst->len)!=0)){
+ dst->s=pve_buf[buf_itr];
+ dst->len=PV_PRINT_BUF_SIZE;
+ buf_itr = (buf_itr+1)%PV_PRINT_BUF_NO;
+ if (unlikely(pv_printf(msg, param->v.pve, dst->s, &dst->len)!=0)){
ERR("Could not convert the PV-formated string to str\n");
dst->len=0;
return -1;
};
- dst->s=pve_buf;
break;
}
return 0;
Module: sip-router
Branch: master
Commit: 21698992bf3e046e4bd127cb0f02a7be4390ecfc
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2169899…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue May 19 10:42:38 2009 +0300
benchmark: scalars converted to unsigned long long
- should fix issue with printing negative values
---
modules_k/benchmark/benchmark.c | 2 +-
modules_k/benchmark/benchmark.h | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/modules_k/benchmark/benchmark.c b/modules_k/benchmark/benchmark.c
index 1b4ede3..bca072a 100644
--- a/modules_k/benchmark/benchmark.c
+++ b/modules_k/benchmark/benchmark.c
@@ -335,7 +335,7 @@ int _bm_log_timer(unsigned int id)
{
LM_GEN1(bm_mycfg->loglevel, "benchmark (timer %s [%d]): %llu ["
" msgs/total/min/max/avg - LR:"
- " %i/%lld/%lld/%lld/%f | GB: %lld/%lld/%lld/%lld/%f]\n",
+ " %i/%llu/%llu/%llu/%f | GB: %llu/%llu/%llu/%llu/%f]\n",
bm_mycfg->tindex[id]->name,
id,
tdiff,
diff --git a/modules_k/benchmark/benchmark.h b/modules_k/benchmark/benchmark.h
index d58a151..cc4e68e 100644
--- a/modules_k/benchmark/benchmark.h
+++ b/modules_k/benchmark/benchmark.h
@@ -58,14 +58,14 @@ typedef struct benchmark_timer
unsigned int id;
int enabled;
bm_timeval_t *start; /* Current timer run */
- long long calls; /* Number of runs of this timer */
- long long sum; /* Accumulated runtime of this timer */
- long long last_sum; /* Accumulated runtime since last logging */
- long long last_max; /* Minimum in current period (between
+ unsigned long long calls; /* Number of runs of this timer */
+ unsigned long long sum; /* Accumulated runtime of this timer */
+ unsigned long long last_sum; /* Accumulated runtime since last logging */
+ unsigned long long last_max; /* Minimum in current period (between
granularity) */
- long long last_min; /* Maximum ... */
- long long global_max; /* Global minimum, since start */
- long long global_min; /* ... maximum ... */
+ unsigned long long last_min; /* Maximum ... */
+ unsigned long long global_max; /* Global minimum, since start */
+ unsigned long long global_min; /* ... maximum ... */
struct benchmark_timer *next;
} benchmark_timer_t;
Module: sip-router
Branch: master
Commit: 8416baf77f30258f34d2de0aa169ad5bb8841561
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8416baf…
Author: Nils Ohlmeier <nils(a)iptel.org>
Committer: Nils Ohlmeier <nils(a)iptel.org>
Date: Tue May 19 02:18:59 2009 +0200
core: increased verbosity of error log message
- added size information to an error log message of the config
framework
---
cfg/cfg.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cfg/cfg.c b/cfg/cfg.c
index c52323c..d6b803b 100644
--- a/cfg/cfg.c
+++ b/cfg/cfg.c
@@ -130,9 +130,9 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int def_size,
/* minor validation */
if (size != def_size) {
- LOG(L_ERR, "ERROR: register_cfg_def(): the specified size of the config "
- "structure does not equal with the calculated size, check whether "
- "the variable types are correctly defined!\n");
+ LOG(L_ERR, "ERROR: register_cfg_def(): the specified size (%i) of the config "
+ "structure does not equal with the calculated size (%i), check whether "
+ "the variable types are correctly defined!\n", def_size, size);
goto error;
}