[sr-dev] git:master:a1f5fbe2: dmq: release resources instead of just doing continue to next job
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jul 31 14:02:11 CEST 2018
Module: kamailio
Branch: master
Commit: a1f5fbe2c18246d4afefa44fd8a52612a5182a46
URL: https://github.com/kamailio/kamailio/commit/a1f5fbe2c18246d4afefa44fd8a52612a5182a46
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-07-31T13:59:44+02:00
dmq: release resources instead of just doing continue to next job
- for cases when processing of the job is not fully completed
---
Modified: src/modules/dmq/worker.c
---
Diff: https://github.com/kamailio/kamailio/commit/a1f5fbe2c18246d4afefa44fd8a52612a5182a46.diff
Patch: https://github.com/kamailio/kamailio/commit/a1f5fbe2c18246d4afefa44fd8a52612a5182a46.patch
---
diff --git a/src/modules/dmq/worker.c b/src/modules/dmq/worker.c
index 9c7873560c..14aadfc998 100644
--- a/src/modules/dmq/worker.c
+++ b/src/modules/dmq/worker.c
@@ -114,7 +114,7 @@ void worker_loop(int id)
current_job->msg, &peer_response, dmq_node);
if(ret_value < 0) {
LM_ERR("running job failed\n");
- continue;
+ goto nextjob;
}
/* add the body to the reply */
if(peer_response.body.s) {
@@ -122,7 +122,7 @@ void worker_loop(int id)
&peer_response.content_type)
< 0) {
LM_ERR("error adding lumps\n");
- continue;
+ goto nextjob;
}
}
/* send the reply */
@@ -130,8 +130,12 @@ void worker_loop(int id)
&peer_response.reason)
< 0) {
LM_ERR("error sending reply\n");
+ } else {
+ LM_DBG("done sending reply\n");
}
+ worker->jobs_processed++;
+nextjob:
/* if body given, free the lumps and free the body */
if(peer_response.body.s) {
del_nonshm_lump_rpl(¤t_job->msg->reply_lump);
@@ -141,10 +145,8 @@ void worker_loop(int id)
free_to(current_job->msg->from->parsed);
}
- LM_DBG("sent reply\n");
shm_free(current_job->msg);
shm_free(current_job);
- worker->jobs_processed++;
}
}
}
More information about the sr-dev
mailing list