[sr-dev] git:5.1:2f713104: dmq: release resources instead of just doing continue to next job

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 22 11:03:34 CEST 2018


Module: kamailio
Branch: 5.1
Commit: 2f713104e6ad0b59e2dbfb0a4062af770e742de5
URL: https://github.com/kamailio/kamailio/commit/2f713104e6ad0b59e2dbfb0a4062af770e742de5

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-08-22T11:03:04+02:00

dmq: release resources instead of just doing continue to next job

- for cases when processing of the job is not fully completed

(cherry picked from commit a1f5fbe2c18246d4afefa44fd8a52612a5182a46)

---

Modified: src/modules/dmq/worker.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2f713104e6ad0b59e2dbfb0a4062af770e742de5.diff
Patch: https://github.com/kamailio/kamailio/commit/2f713104e6ad0b59e2dbfb0a4062af770e742de5.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(&current_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