瀏覽代碼

modules/ims_auth, modules/ims_registrar_scscf: fix condition for private copy of the msg

Federico Cabiddu 9 年之前
父節點
當前提交
905961bd4a

+ 7 - 6
modules/ims_auth/pvt_message.c

@@ -82,7 +82,7 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
         (which we cannot assume) then we would pollute the shm_msg t->uas.request if we did any parsing on it. Instead, we need to 
         make a private copy of the message and free it when we are done 
          */
-        if (_pv_treq.T != t || t->uas.request != _pv_treq.tmsgp) {
+	if (_pv_treq.label != t->label || _pv_treq.index != t->hash_index) {		
             /* make a copy */
             if (_pv_treq.buf == NULL || _pv_treq.buf_size < t->uas.request->len + 1) {
                 if (_pv_treq.buf != NULL)
@@ -90,8 +90,8 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
                 if (_pv_treq.tmsgp)
                     free_sip_msg(&_pv_treq.msg);
                 _pv_treq.tmsgp = NULL;
-                _pv_treq.id = 0;
-                _pv_treq.T = NULL;
+                _pv_treq.index = 0;
+                _pv_treq.label = 0;
                 _pv_treq.buf_size = t->uas.request->len + 1;
                 _pv_treq.buf = (char*) pkg_malloc(_pv_treq.buf_size * sizeof (char));
                 if (_pv_treq.buf == NULL) {
@@ -108,8 +108,8 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
             _pv_treq.msg.len = t->uas.request->len;
             _pv_treq.msg.buf = _pv_treq.buf;
             _pv_treq.tmsgp = t->uas.request;
-            _pv_treq.id = t->uas.request->id;
-            _pv_treq.T = t;
+            _pv_treq.index = t->hash_index;
+            _pv_treq.label = t->label;
 
 
             if (pv_t_copy_msg(t->uas.request, &_pv_treq.msg) != 0) {
@@ -117,7 +117,8 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
                 _pv_treq.buf_size = 0;
                 _pv_treq.buf = NULL;
                 _pv_treq.tmsgp = NULL;
-                _pv_treq.T = NULL;
+                _pv_treq.index = 0;
+                _pv_treq.label = 0;
                 return 0;
             }
         }

+ 3 - 2
modules/ims_auth/pvt_message.h

@@ -47,12 +47,13 @@
 
 
 #include "../../parser/msg_parser.h"
+#include "../tm/tm_load.h"
 
 struct _pv_req_data {
-    struct cell *T;
     struct sip_msg msg;
     struct sip_msg *tmsgp;
-    unsigned int id;
+    unsigned int index;
+    unsigned int label;
     char *buf;
     int buf_size;
 };

+ 8 - 7
modules/ims_registrar_scscf/pvt_message.c

@@ -84,7 +84,7 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
         (which we cannot assume) then we would pollute the shm_msg t->uas.request if we did any parsing on it. Instead, we need to 
         make a private copy of the message and free it when we are done 
          */
-        if ((_pv_treq.T != t || t->uas.request != _pv_treq.tmsgp)) { 
+	if (_pv_treq.label != t->label || _pv_treq.index != t->hash_index) {		
             /* make a copy */
             if (_pv_treq.buf == NULL || _pv_treq.buf_size < t->uas.request->len + 1) {
                 if (_pv_treq.buf != NULL)
@@ -92,8 +92,8 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
                 if (_pv_treq.tmsgp)
                     free_sip_msg(&_pv_treq.msg);
                 _pv_treq.tmsgp = NULL;
-                _pv_treq.id = 0;
-                _pv_treq.T = NULL;
+                _pv_treq.index = 0;
+                _pv_treq.label = 0;
                 _pv_treq.buf_size = t->uas.request->len + 1;
                 _pv_treq.buf = (char*) pkg_malloc(_pv_treq.buf_size * sizeof (char));
                 if (_pv_treq.buf == NULL) {
@@ -110,8 +110,8 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
             _pv_treq.msg.len = t->uas.request->len;
             _pv_treq.msg.buf = _pv_treq.buf;
             _pv_treq.tmsgp = t->uas.request;
-            _pv_treq.id = t->uas.request->id;
-            _pv_treq.T = t;
+            _pv_treq.index = t->hash_index;
+            _pv_treq.label = t->label;
 
 
             if (pv_t_copy_msg(t->uas.request, &_pv_treq.msg) != 0) {
@@ -119,7 +119,8 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
                 _pv_treq.buf_size = 0;
                 _pv_treq.buf = NULL;
                 _pv_treq.tmsgp = NULL;
-                _pv_treq.T = NULL;
+                _pv_treq.index = 0;
+                _pv_treq.label = 0;
                 return 0;
             }
         }
@@ -128,4 +129,4 @@ struct sip_msg* get_request_from_tx(struct cell *t) {
     } else
         return 0;
 
-}
+}

+ 3 - 2
modules/ims_registrar_scscf/pvt_message.h

@@ -49,12 +49,13 @@
 
 
 #include "../../parser/msg_parser.h"
+#include "../tm/tm_load.h"
 
 struct _pv_req_data {
-    struct cell *T;
     struct sip_msg msg;
     struct sip_msg *tmsgp;
-    unsigned int id;
+    unsigned int index;
+    unsigned int label;
     char *buf;
     int buf_size;
 };