mirror of https://github.com/sipwise/kamailio.git
Change-Id: I5fe19a1e664df9aa8f17117950636a741244d382
(cherry picked from commit b50f17c377)
mr11.5
parent
f7ebcdad72
commit
4cd4424928
@ -0,0 +1,80 @@
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Tue, 21 Nov 2023 15:30:03 +0100
|
||||
Subject: core: timer_proc don't execute timers on shutdown phase
|
||||
|
||||
---
|
||||
src/core/timer_proc.c | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/src/core/timer_proc.c b/src/core/timer_proc.c
|
||||
index 0b04cf6..55bd98d 100644
|
||||
--- a/src/core/timer_proc.c
|
||||
+++ b/src/core/timer_proc.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "pt.h"
|
||||
#include "ut.h"
|
||||
#include "mem/shm_mem.h"
|
||||
+#include "sr_module.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -76,6 +77,9 @@ int fork_basic_timer(int child_id, char *desc, int make_sock, timer_function *f,
|
||||
if(cfg_child_init())
|
||||
return -1;
|
||||
for(;;) {
|
||||
+ if(unlikely(ksr_shutdown_phase() != 0)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
sleep(interval);
|
||||
cfg_update();
|
||||
f(get_ticks(), param); /* ticks in s for compatibility with old
|
||||
@@ -99,6 +103,9 @@ int fork_basic_timer_w(int child_id, char *desc, int make_sock,
|
||||
if(cfg_child_init())
|
||||
return -1;
|
||||
for(;;) {
|
||||
+ if(unlikely(ksr_shutdown_phase() != 0)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
sleep(interval);
|
||||
cfg_update();
|
||||
f(get_ticks(), worker,
|
||||
@@ -141,6 +148,9 @@ int fork_basic_utimer(int child_id, char *desc, int make_sock,
|
||||
if(cfg_child_init())
|
||||
return -1;
|
||||
for(;;) {
|
||||
+ if(unlikely(ksr_shutdown_phase() != 0)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
sleep_us(uinterval);
|
||||
cfg_update();
|
||||
ts = get_ticks_raw();
|
||||
@@ -165,6 +175,9 @@ int fork_basic_utimer_w(int child_id, char *desc, int make_sock,
|
||||
if(cfg_child_init())
|
||||
return -1;
|
||||
for(;;) {
|
||||
+ if(unlikely(ksr_shutdown_phase() != 0)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
sleep_us(uinterval);
|
||||
cfg_update();
|
||||
ts = get_ticks_raw();
|
||||
@@ -273,6 +286,9 @@ int fork_sync_timer(int child_id, char *desc, int make_sock, timer_function *f,
|
||||
if(cfg_child_init())
|
||||
return -1;
|
||||
for(;;) {
|
||||
+ if(unlikely(ksr_shutdown_phase() != 0)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
if(ts2 > interval)
|
||||
sleep_us(1000); /* 1 millisecond sleep to catch up */
|
||||
else
|
||||
@@ -324,6 +340,9 @@ int fork_sync_utimer(int child_id, char *desc, int make_sock,
|
||||
if(cfg_child_init())
|
||||
return -1;
|
||||
for(;;) {
|
||||
+ if(unlikely(ksr_shutdown_phase() != 0)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
if(ts2 > uinterval)
|
||||
sleep_us(1);
|
||||
else
|
||||
Loading…
Reference in new issue