Module: kamailio Branch: master Commit: b6e2dce80a607b12276addea310c9696c3c39ce9 URL: https://github.com/kamailio/kamailio/commit/b6e2dce80a607b12276addea310c9696...
Author: Stefan Mititelu stefan.mititelu@1and1.ro Committer: Stefan Mititelu stefan.mititelu@1and1.ro Date: 2016-01-27T14:19:21+02:00
rtpengine: Init and dealloc hastable locks
Right now only alloc and destroy is done. Also do init and dealloc.
---
Modified: modules/rtpengine/rtpengine_hash.c
---
Diff: https://github.com/kamailio/kamailio/commit/b6e2dce80a607b12276addea310c9696... Patch: https://github.com/kamailio/kamailio/commit/b6e2dce80a607b12276addea310c9696...
---
diff --git a/modules/rtpengine/rtpengine_hash.c b/modules/rtpengine/rtpengine_hash.c index f8e610d..b36e93e 100644 --- a/modules/rtpengine/rtpengine_hash.c +++ b/modules/rtpengine/rtpengine_hash.c @@ -92,7 +92,7 @@ int rtpengine_hash_table_init(int size) {
// init hashtable row_locks[i], row_entry_list[i] and row_totals[i] for (i = 0; i < hash_table_size; i++) { - // init hashtable row_locks[i] + // alloc hashtable row_locks[i] rtpengine_hash_table->row_locks[i] = lock_alloc(); if (!rtpengine_hash_table->row_locks[i]) { LM_ERR("no shm left to create rtpengine_hash_table->row_locks[%d]\n", i); @@ -100,6 +100,13 @@ int rtpengine_hash_table_init(int size) { return 0; }
+ // init hashtable row_locks[i] + if (!lock_init(rtpengine_hash_table->row_locks[i])) { + LM_ERR("fail to init rtpengine_hash_table->row_locks[%d]\n", i); + rtpengine_hash_table_destroy(); + return 0; + } + // init hashtable row_entry_list[i] rtpengine_hash_table->row_entry_list[i] = shm_malloc(sizeof(struct rtpengine_hash_entry)); if (!rtpengine_hash_table->row_entry_list[i]) { @@ -511,6 +518,7 @@ static void rtpengine_hash_table_free_row_lock(gen_lock_t *row_lock) { }
lock_destroy(row_lock); + lock_dealloc(row_lock);
return ; }