Module: kamailio Branch: master Commit: e6cf3c9bc0018f96acaa4928089273480a54582f URL: https://github.com/kamailio/kamailio/commit/e6cf3c9bc0018f96acaa492808927348...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-01-21T14:44:44+01:00
core: wheel timer advertised as secondary timer
- safety checks when running wtimer functions
---
Modified: timer_proc.c
---
Diff: https://github.com/kamailio/kamailio/commit/e6cf3c9bc0018f96acaa492808927348... Patch: https://github.com/kamailio/kamailio/commit/e6cf3c9bc0018f96acaa492808927348...
---
diff --git a/timer_proc.c b/timer_proc.c index a0a4c17..ed52218 100644 --- a/timer_proc.c +++ b/timer_proc.c @@ -304,7 +304,7 @@ int sr_wtimer_init(void) if(_sr_wtimer!=NULL) return 0; _sr_wtimer = (sr_wtimer_t *)pkg_malloc(sizeof(sr_wtimer_t)); - if(_sr_wtimer!=NULL) { + if(_sr_wtimer==NULL) { LM_ERR("no more pkg memory\n"); return -1; } @@ -320,7 +320,7 @@ int sr_wtimer_init(void) int sr_wtimer_add(timer_function* f, void* param, int interval) { sr_wtimer_node_t *wt; - if(_sr_wtimer!=NULL) { + if(_sr_wtimer==NULL) { LM_ERR("wtimer not intialized\n"); return -1; } @@ -351,7 +351,7 @@ void sr_wtimer_exec(unsigned int ticks, void *param) uint32_t i; uint32_t c;
- if(_sr_wtimer!=NULL) { + if(_sr_wtimer==NULL) { LM_ERR("wtimer not intialized\n"); return; } @@ -376,12 +376,12 @@ void sr_wtimer_exec(unsigned int ticks, void *param) */ int sr_wtimer_start(void) { - if(_sr_wtimer!=NULL) { + if(_sr_wtimer==NULL) { LM_ERR("wtimer not intialized\n"); return -1; }
- if(fork_sync_timer(-1 /*PROC_TIMER*/, "WTIMER", 1, + if(fork_sync_timer(-1 /*PROC_TIMER*/, "secondary timer", 1, sr_wtimer_exec, NULL, 1)<0) { LM_ERR("wtimer starting failed\n"); return -1;