Module: kamailio
Branch: master
Commit: 569b536404afd855742a42320d7c858a8bb4952b
URL: https://github.com/kamailio/kamailio/commit/569b536404afd855742a42320d7c858…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-01-22T14:11:29+01:00
tm: mark request with final reply flag
- send error function checks flag and returns if set to avoid sending
more than one final reply in case of failure
---
Modified: src/modules/tm/t_reply.c
Modified: src/modules/tm/tm.c
---
Diff: https://github.com/kamailio/kamailio/commit/569b536404afd855742a42320d7c858…
Patch: https://github.com/kamailio/kamailio/commit/569b536404afd855742a42320d7c858…
---
diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c
index f52ecc7d3ad..e012dc29c28 100644
--- a/src/modules/tm/t_reply.c
+++ b/src/modules/tm/t_reply.c
@@ -640,6 +640,11 @@ static int _reply_light(struct cell *trans, char *buf, unsigned int len,
* (timer_allow_del()) (there's no chance of having the wait handler
* executed while we still need t) --andrei */
put_on_wait(trans);
+
+ /* mark the request with final reply flag */
+ if(trans->uas.request != NULL) {
+ trans->uas.request->msg_flags |= FL_FINAL_REPLY;
+ }
}
pkg_free(buf);
LM_DBG("finished\n");
diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index 0be958a0848..0147bf44579 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -1608,6 +1608,11 @@ int ki_t_reply_error(sip_msg_t *msg)
int sip_err;
int ret;
+ if(msg->msg_flags & FL_FINAL_REPLY) {
+ LM_INFO("message marked with final-reply flag\n");
+ return -2;
+ }
+
ret = err2reason_phrase(
prev_ser_error, &sip_err, err_buffer, sizeof(err_buffer), "TM");
if(ret > 0) {
Module: kamailio
Branch: master
Commit: 0a11489d4b699a62596b2c4626171e8d92e966fd
URL: https://github.com/kamailio/kamailio/commit/0a11489d4b699a62596b2c4626171e8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-01-21T10:20:39+01:00
lib/srdb2: review and adapt old comments
---
Modified: src/lib/srdb2/db_cmd.c
Modified: src/lib/srdb2/db_gen.h
---
Diff: https://github.com/kamailio/kamailio/commit/0a11489d4b699a62596b2c4626171e8…
Patch: https://github.com/kamailio/kamailio/commit/0a11489d4b699a62596b2c4626171e8…
---
diff --git a/src/lib/srdb2/db_cmd.c b/src/lib/srdb2/db_cmd.c
index 2782f4dc7c5..9ba1d22ee66 100644
--- a/src/lib/srdb2/db_cmd.c
+++ b/src/lib/srdb2/db_cmd.c
@@ -58,7 +58,7 @@ db_cmd_t *db_cmd(enum db_cmd_type type, db_ctx_t *ctx, char *table,
newp->type = type;
- /** FIXME: it is not clear now that this is necessary
+ /** NOTE: it is not clear now that this is necessary
* when we have match and value separate arrays */
if(result) {
newp->result = db_fld_copy(result);
@@ -78,7 +78,7 @@ db_cmd_t *db_cmd(enum db_cmd_type type, db_ctx_t *ctx, char *table,
goto err;
}
- /* FIXME: This should be redesigned so that we do not need to connect
+ /* NOTE: This should be redesigned so that we do not need to connect
* connections in context before commands are created, this takes splitting
* the command initialization sequence in two steps, one would be creating
* all the data structures and the second would be checking corresponding
@@ -242,7 +242,6 @@ int db_exec(db_res_t **res, db_cmd_t *cmd)
return -1;
}
- /* FIXME */
db_payload_idx = 0;
ret = cmd->exec[0](r, cmd);
if(ret < 0) {
diff --git a/src/lib/srdb2/db_gen.h b/src/lib/srdb2/db_gen.h
index eca24c76046..f8dd483b87a 100644
--- a/src/lib/srdb2/db_gen.h
+++ b/src/lib/srdb2/db_gen.h
@@ -95,7 +95,7 @@ extern "C"
*/
/*
- * FIXME: We should find some other way of doing this than just copying
+ * NOTE: We should find some other way of doing this than just copying
* and pasting the code from STAILQ_FOREACH
*/
#define DBLIST_FOREACH(var, head) \
@@ -111,7 +111,7 @@ extern "C"
*/
/*
- * FIXME: We should find some other way of doing this than just copying
+ * NOTE: We should find some other way of doing this than just copying
* and pasting the code from STAILQ_FOREACH_SAFE
*/
#define DBLIST_FOREACH_SAFE(var, head, tvar) \