Module: kamailio
Branch: master
Commit: 4cf65a7ee1f1803c7c1471f35dcddc8f55c958b1
URL: https://github.com/kamailio/kamailio/commit/4cf65a7ee1f1803c7c1471f35dcddc8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-03-16T13:11:09+01:00
dmq: init internal tcp socket and global cfg structure for worker
---
Modified: src/modules/dmq/dmq.c
Modified: src/modules/dmq/worker.c
---
Diff: https://github.com/kamailio/kamailio/commit/4cf65a7ee1f1803c7c1471f35dcddc8…
Patch: https://github.com/kamailio/kamailio/commit/4cf65a7ee1f1803c7c1471f35dcddc8…
---
diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c
index 4230e48a7f..0a807a983f 100644
--- a/src/modules/dmq/dmq.c
+++ b/src/modules/dmq/dmq.c
@@ -37,6 +37,7 @@
#include "../../core/pt.h"
#include "../../core/hashes.h"
#include "../../core/mod_fix.h"
+#include "../../core/cfg/cfg_struct.h"
#include "../../core/rpc_lookup.h"
#include "../../core/kemi.h"
@@ -299,11 +300,12 @@ static int child_init(int rank)
/* fork worker processes */
for(i = 0; i < dmq_num_workers; i++) {
LM_DBG("starting worker process %d\n", i);
- newpid = fork_process(PROC_RPC, "DMQ WORKER", 0);
+ newpid = fork_process(PROC_RPC, "DMQ WORKER", 1);
if(newpid < 0) {
LM_ERR("failed to fork worker process %d\n", i);
return -1;
} else if(newpid == 0) {
+ if (cfg_child_init()) return -1;
/* child - this will loop forever */
worker_loop(i);
} else {
@@ -327,7 +329,7 @@ static int child_init(int rank)
return 0;
}
if(rank == PROC_TCP_MAIN) {
- /* do nothing for the main process */
+ /* do nothing for the tcp main process */
return 0;
}
diff --git a/src/modules/dmq/worker.c b/src/modules/dmq/worker.c
index 43d76da309..fa4025fff2 100644
--- a/src/modules/dmq/worker.c
+++ b/src/modules/dmq/worker.c
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
@@ -29,6 +29,7 @@
#include "../../core/sip_msg_clone.h"
#include "../../core/parser/parse_from.h"
#include "../../core/parser/parse_to.h"
+#include "../../core/cfg/cfg_struct.h"
/**
* @brief set the body of a response
@@ -88,6 +89,7 @@ void worker_loop(int id)
} else {
sleep_us(dmq_worker_usleep);
}
+ cfg_update();
/* remove from queue until empty */
while(job_queue_size(worker->queue) > 0) {