Module: kamailio
Branch: master
Commit: 8683deb20a3f69c3b6d2c8370d23d1451f823a6b
URL:
https://github.com/kamailio/kamailio/commit/8683deb20a3f69c3b6d2c8370d23d14…
Author: Anthony Alba <ascanio.alba7(a)gmail.com>
Committer: Anthony Alba <ascanio.alba7(a)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/8683deb20a3f69c3b6d2c8370d23d14…
Patch:
https://github.com/kamailio/kamailio/commit/8683deb20a3f69c3b6d2c8370d23d14…
---
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