[sr-dev] [kamailio] rtpengine: hash table to keep the selected nodes (#390)

Richard Fuchs notifications at github.com
Wed Nov 11 17:46:34 CET 2015


> +	}
> +	LM_DBG("rtpengine_hash_table size = %d\n", hash_table_size);
> +
> +	// init hashtable
> +	rtpengine_hash_table = shm_malloc(sizeof(struct rtpengine_hash_table));
> +	if (!rtpengine_hash_table) {
> +		LM_ERR("no shm left to create rtpengine_hash_table\n");
> +		return 0;
> +	}
> +
> +	// init hashtable entry_list
> +	rtpengine_hash_table->entry_list = shm_malloc(hash_table_size * sizeof(struct rtpengine_hash_entry));
> +
> +	// init hashtable entry_list[i] (head never filled)
> +	for (i = 0; i < hash_table_size; i++) {
> +		rtpengine_hash_table->entry_list[i] = shm_malloc(sizeof(struct rtpengine_hash_entry));

I don't think shm_malloc() automatically zeroes the memory, and the lookup routines seem to do a strcmp on the head entries call-ID too, so the call-ID needs to be initialized as well.

---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/390/files#r44554482
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20151111/f14dab85/attachment.html>


More information about the sr-dev mailing list