[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sr-dev
Subject:    [sr-dev] git:master:1194f597: core: timer_proc don't execute timers on shutdown phase
From:       Victor Seva via sr-dev <sr-dev () lists ! kamailio ! org>
Date:       2023-11-28 12:03:53
Message-ID: E1r7woj-00071V-O8 () www ! kamailio ! org
[Download RAW message or body]

Module: kamailio
Branch: master
Commit: 1194f59738e87fcbf0d61c95d1d481e5fbb46784
URL: https://github.com/kamailio/kamailio/commit/1194f59738e87fcbf0d61c95d1d481e5fbb46784

Author: Victor Seva <linuxmaniac@torreviejawireless.org>
Committer: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: 2023-11-28T13:03:38+01:00

core: timer_proc don't execute timers on shutdown phase

---

Modified: src/core/timer_proc.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1194f59738e87fcbf0d61c95d1d481e5fbb46784.diff
Patch: https://github.com/kamailio/kamailio/commit/1194f59738e87fcbf0d61c95d1d481e5fbb46784.patch

---

diff --git a/src/core/timer_proc.c b/src/core/timer_proc.c
index 0b04cf65131..55bd98dab9c 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

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic