[asterisk-commits] rmudgett: branch 12 r398579 - /branches/12/main/cdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 6 16:16:53 CDT 2013


Author: rmudgett
Date: Fri Sep  6 16:16:51 2013
New Revision: 398579

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398579
Log:
cdr: Change the number of container buckets to be similar to the channels container.

* Fix the temporary cdr candidate containers to use a prime number of
buckets.

Modified:
    branches/12/main/cdr.c

Modified: branches/12/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/cdr.c?view=diff&rev=398579&r1=398578&r2=398579
==============================================================================
--- branches/12/main/cdr.c (original)
+++ branches/12/main/cdr.c Fri Sep  6 16:16:51 2013
@@ -192,6 +192,13 @@
  ***/
 
 
+/* The prime here should be similar in size to the channel container. */
+#ifdef LOW_MEMORY
+#define NUM_CDR_BUCKETS 61
+#else
+#define NUM_CDR_BUCKETS 769
+#endif
+
 #define DEFAULT_ENABLED "1"
 #define DEFAULT_BATCHMODE "0"
 #define DEFAULT_UNANSWERED "0"
@@ -2279,7 +2286,7 @@
  */
 static struct ao2_container *create_candidates_for_bridge(struct ast_bridge_snapshot *bridge)
 {
-	struct ao2_container *candidates = ao2_container_alloc(51, bridge_candidate_hash_fn, bridge_candidate_cmp_fn);
+	struct ao2_container *candidates = ao2_container_alloc(61, bridge_candidate_hash_fn, bridge_candidate_cmp_fn);
 	char *bridge_id = ast_strdupa(bridge->uniqueid);
 	struct ao2_iterator *it_cdrs;
 	struct cdr_object *cand_cdr_master;
@@ -2429,11 +2436,7 @@
 	if (!candidates) {
 		return;
 	}
-	ao2_callback(candidates, OBJ_NODATA,
-			bridge_candidate_process,
-			cdr);
-
-	return;
+	ao2_callback(candidates, OBJ_NODATA, bridge_candidate_process, cdr);
 }
 
 /*! \brief Handle entering into a parking bridge
@@ -4029,7 +4032,6 @@
 	}
 }
 
-
 int ast_cdr_engine_init(void)
 {
 	RAII_VAR(struct module_config *, mod_cfg, NULL, ao2_cleanup);
@@ -4038,8 +4040,8 @@
 		return -1;
 	}
 
-	/* The prime here should be the same as the channel container */
-	active_cdrs_by_channel = ao2_container_alloc(51, cdr_object_channel_hash_fn, cdr_object_channel_cmp_fn);
+	active_cdrs_by_channel = ao2_container_alloc(NUM_CDR_BUCKETS,
+		cdr_object_channel_hash_fn, cdr_object_channel_cmp_fn);
 	if (!active_cdrs_by_channel) {
 		return -1;
 	}




More information about the asterisk-commits mailing list