[sr-dev] git:master:8683deb2: app_python3: use _ksr_is_main to detect child process

Anthony Alba ascanio.alba7 at gmail.com
Fri Jun 10 16:19:23 CEST 2022


Module: kamailio
Branch: master
Commit: 8683deb20a3f69c3b6d2c8370d23d1451f823a6b
URL: https://github.com/kamailio/kamailio/commit/8683deb20a3f69c3b6d2c8370d23d1451f823a6b

Author: Anthony Alba <ascanio.alba7 at gmail.com>
Committer: Anthony Alba <ascanio.alba7 at gmail.com>
Date: 2022-06-10T22:13:39+08:00

app_python3: use _ksr_is_main to detect child process

---

Modified: src/modules/app_python3/app_python3_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/8683deb20a3f69c3b6d2c8370d23d1451f823a6b.diff
Patch: https://github.com/kamailio/kamailio/commit/8683deb20a3f69c3b6d2c8370d23d1451f823a6b.patch

---

diff --git a/src/modules/app_python3/app_python3_mod.c b/src/modules/app_python3/app_python3_mod.c
index d250640e0c..376d1c1312 100644
--- a/src/modules/app_python3/app_python3_mod.c
+++ b/src/modules/app_python3/app_python3_mod.c
@@ -185,9 +185,6 @@ static int child_init(int rank)
 		 * this is called before any process is forked
 		 * so the Python internal state handler
 		 * should be called now.
-		 *
-		 * TODO: is PyOS_AfterFork_Parent() necesary
-		 * in the main process?
 		 */
 #if PY_VERSION_HEX >= 0x03070000
 		PyOS_BeforeFork() ;
@@ -206,7 +203,7 @@ static int child_init(int rank)
 	}
 	_apy_process_rank = rank;
 
-	if (rank > 0) {
+	if (!_ksr_is_main) {
 #if PY_VERSION_HEX >= 0x03070000
 		PyOS_AfterFork_Child();
 #else




More information about the sr-dev mailing list