Module: kamailio
Branch: master
Commit: 60db119bf8388f047cb7f7e2ce9f2e740b5abb8d
URL:
https://github.com/kamailio/kamailio/commit/60db119bf8388f047cb7f7e2ce9f2e7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-11-09T06:42:49+01:00
core: warning when a task is pushed but no workers
- helper functions to get the number of workers
---
Modified: src/core/async_task.c
Modified: src/core/async_task.h
---
Diff:
https://github.com/kamailio/kamailio/commit/60db119bf8388f047cb7f7e2ce9f2e7…
Patch:
https://github.com/kamailio/kamailio/commit/60db119bf8388f047cb7f7e2ce9f2e7…
---
diff --git a/src/core/async_task.c b/src/core/async_task.c
index 956bd9ae8b..ab2376a446 100644
--- a/src/core/async_task.c
+++ b/src/core/async_task.c
@@ -53,6 +53,25 @@ int async_task_run(int idx);
/**
*
*/
+int async_task_workers_get(void)
+{
+ return _async_task_workers;
+}
+
+/**
+ *
+ */
+int async_task_workers_active(void)
+{
+ if(_async_task_workers<=0)
+ return 0;
+
+ return 1;
+}
+
+/**
+ *
+ */
int async_task_init_sockets(void)
{
if (socketpair(PF_UNIX, SOCK_DGRAM, 0, _async_task_sockets) < 0) {
@@ -195,8 +214,10 @@ int async_task_push(async_task_t *task)
{
int len;
- if(_async_task_workers<=0)
+ if(_async_task_workers<=0) {
+ LM_WARN("async task pushed, but no async workers - ignoring\n");
return 0;
+ }
len = write(_async_task_sockets[1], &task, sizeof(async_task_t*));
if(len<=0) {
diff --git a/src/core/async_task.h b/src/core/async_task.h
index 620009b4f6..55c558c30d 100644
--- a/src/core/async_task.h
+++ b/src/core/async_task.h
@@ -37,5 +37,7 @@ int async_task_initialized(void);
int async_task_set_workers(int n);
int async_task_push(async_task_t *task);
int async_task_set_usleep(int n);
+int async_task_workers_get(void);
+int async_task_workers_active(void);
#endif