[sr-dev] [kamailio/kamailio] registrar: added new parameter sock_addr (#2498)

Daniel-Constantin Mierla notifications at github.com
Mon Oct 5 18:48:28 CEST 2020


This works when listening on a single socket, right?

While that is ok for some use cases, if you want to have the advertised address of a listen socket, then this can be coded in a different way, by saving `socket->useinfo.sock_str` instead of `socket->sock_str`.

If you still want to have a parameter like in your patch, it is fine for me, even it has rather limited usage, but in this case I think it should use a static variable in pack_ci() function, like all the other variables in the function that are used outside, to avoid the pkg_malloc() and the pkg_free(), so declare:

```
static struct socket_info si = {0};
```

Then have something like:

```
		if (sock_addr.len>0) {
			memset(&si, 0, sizeof(struct socket_info));
			si.sock_str = sock_addr;
			ci.sock = &si;
...
```

Then IF blocks to do `pkg_free(si);` and `pkg_free(ci->sock);` should dissapear, having the changes only inside the pack_ci() function.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2498#issuecomment-703753670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20201005/78327334/attachment.htm>


More information about the sr-dev mailing list