Module: kamailio
Branch: master
Commit: 21addddda9a520f6f1aace3ac3f25de897e60e4d
URL: 
https://github.com/kamailio/kamailio/commit/21addddda9a520f6f1aace3ac3f25de897e60e4d

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2018-06-12T09:48:44+02:00

dispatcher: store socket pointer in xavp instead serializing address to string

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/21addddda9a520f6f1aace3ac3f25de897e60e4d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/21addddda9a520f6f1aace3ac3f25de897e60e4d.patch

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index 15d17b36c0..a63f150308 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -1836,9 +1836,8 @@ int ds_add_xavp_record(ds_set_t *dsidx, int pos, int set, 
int alg)
 
        if(dsidx->dlist[pos].sock) {
                memset(&nxval, 0, sizeof(sr_xval_t));
-               nxval.type = SR_XTYPE_STR;
-               nxval.v.s.len = 1 + sprintf(buf, "%p", dsidx->dlist[pos].sock);
-               nxval.v.s.s = buf;
+               nxval.type = SR_XTYPE_VPTR;
+               nxval.v.vptr = dsidx->dlist[pos].sock;
                if(xavp_add_value(&ds_xavp_dst_sock, &nxval, &nxavp)==NULL) {
                        xavp_destroy_list(&nxavp);
                        LM_ERR("failed to add destination sock xavp field\n");
@@ -2203,11 +2202,9 @@ int ds_next_dst(struct sip_msg *msg, int mode)
        }
 
        lxavp = xavp_get(&ds_xavp_dst_sock, rxavp);
-       if(lxavp!=NULL && lxavp->val.type==SR_XTYPE_STR) {
+       if(lxavp!=NULL && lxavp->val.type==SR_XTYPE_VPTR) {
                LM_DBG("socket enforced in next destination record\n");
-               if(sscanf(lxavp->val.v.s.s, "%p", (void **)&sock) != 1) {
-                       sock = NULL;
-               }
+               sock = lxavp->val.v.vptr;
        }
 
        lxavp = xavp_get(&ds_xavp_dst_addr, rxavp);


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

Reply via email to