Module: kamailio
Branch: master
Commit: 46ea6b0a6bcf55243a0d11be41f60a2678dbbcfb
URL: 
https://github.com/kamailio/kamailio/commit/46ea6b0a6bcf55243a0d11be41f60a2678dbbcfb

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2017-05-16T17:33:10+02:00

core: wrapper function to reset avps/xavps from msg environment

- use it to clean after processing received msg

---

Modified: src/core/receive.c
Modified: src/core/receive.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/46ea6b0a6bcf55243a0d11be41f60a2678dbbcfb.diff
Patch: 
https://github.com/kamailio/kamailio/commit/46ea6b0a6bcf55243a0d11be41f60a2678dbbcfb.patch

---

diff --git a/src/core/receive.c b/src/core/receive.c
index 3a863be..8dc1007 100644
--- a/src/core/receive.c
+++ b/src/core/receive.c
@@ -362,11 +362,7 @@ int receive_msg(char* buf, unsigned int len, struct 
receive_info* rcv_info)
 #ifdef STATS
        skipped = 0;
 #endif
-       /* free possible loaded avps -bogdan */
-       reset_avps();
-#ifdef WITH_XAVP
-       xavp_reset_list();
-#endif
+       ksr_msg_env_reset();
        LM_DBG("cleaning up\n");
        free_sip_msg(msg);
        pkg_free(msg);
@@ -392,13 +388,21 @@ int receive_msg(char* buf, unsigned int len, struct 
receive_info* rcv_info)
        free_sip_msg(msg);
        pkg_free(msg);
 error00:
-       reset_avps();
-#ifdef WITH_XAVP
-       xavp_reset_list();
-#endif
+       ksr_msg_env_reset();
        STATS_RX_DROPS;
        /* reset log prefix */
        log_prefix_set(NULL);
        return -1;
 }
 
+/**
+ * clean up msg environment, such as avp and xavp lists
+ */
+void ksr_msg_env_reset(void)
+{
+       reset_avps();
+#ifdef WITH_XAVP
+       xavp_reset_list();
+#endif
+
+}
diff --git a/src/core/receive.h b/src/core/receive.h
index 4e6a13d..0a928c5 100644
--- a/src/core/receive.h
+++ b/src/core/receive.h
@@ -33,5 +33,6 @@
 
 int receive_msg(char* buf, unsigned int len, struct receive_info *ri);
 unsigned int inc_msg_no(void);
+void ksr_msg_env_reset(void);
 
 #endif


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to