[sr-dev] git:master:8bc037bc: dialog: skip printing profiles and vars in terminated state for rpc dialog list

Daniel-Constantin Mierla miconda at gmail.com
Sun Mar 25 06:37:10 CEST 2018


Module: kamailio
Branch: master
Commit: 8bc037bc87ced907b8b2e59a2c5fcb45291836fd
URL: https://github.com/kamailio/kamailio/commit/8bc037bc87ced907b8b2e59a2c5fcb45291836fd

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-03-25T06:34:49+02:00

dialog: skip printing profiles and vars in terminated state for rpc dialog list

- they can be delelted at that point, not being referenced by the same
field

---

Modified: src/modules/dialog/dialog.c

---

Diff:  https://github.com/kamailio/kamailio/commit/8bc037bc87ced907b8b2e59a2c5fcb45291836fd.diff
Patch: https://github.com/kamailio/kamailio/commit/8bc037bc87ced907b8b2e59a2c5fcb45291836fd.patch

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index e6ff0e9bc3..7fb5013afb 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -1945,7 +1945,7 @@ static inline void internal_rpc_print_dlg(rpc_t *rpc, void *c, dlg_cell_t *dlg,
 		"socket", dlg->bind_addr[DLG_CALLEE_LEG] ? &dlg->bind_addr[DLG_CALLEE_LEG]->sock_str : &empty_str);
 
 	if (rpc->struct_add(h, "[", "profiles", &sh) < 0) goto error;
-	for (pl = dlg->profile_links ; pl ; pl=pl->next) {
+	for (pl = dlg->profile_links ; pl && (dlg->state<DLG_STATE_DELETED) ; pl=pl->next) {
 		if (pl->profile->has_value) {
 			rpc->array_add(sh, "{", &ssh);
 			rpc->struct_add(ssh, "S", pl->profile->name.s, &pl->hash_linker.value);
@@ -1955,7 +1955,7 @@ static inline void internal_rpc_print_dlg(rpc_t *rpc, void *c, dlg_cell_t *dlg,
 	}
 
 	if (rpc->struct_add(h, "[", "variables", &sh) < 0) goto error;
-	for(var=dlg->vars ; var ; var=var->next) {
+	for(var=dlg->vars ; var && (dlg->state<DLG_STATE_DELETED) ; var=var->next) {
 		rpc->array_add(sh, "{", &ssh);
 		rpc->struct_add(ssh, "S", var->key.s, &var->value);
 	}




More information about the sr-dev mailing list