[asterisk-commits] mmichelson: branch group/CCSS r247840 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 18 17:04:48 CST 2010
Author: mmichelson
Date: Thu Feb 18 17:04:44 2010
New Revision: 247840
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247840
Log:
Add core_id to beginning of CC logger level messages where possible and appropriate.
Modified:
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=247840&r1=247839&r2=247840
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Feb 18 17:04:44 2010
@@ -1190,7 +1190,8 @@
return 0;
}
- ast_log_dynamic_level(cc_logger_level, "Canceling generic monitor available timer for monitor %s\n", monitor->interface->device_name);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Canceling generic monitor available timer for monitor %s\n",
+ monitor->core_id, monitor->interface->device_name);
ast_sched_thread_del(cc_sched_thread, *sched_id);
*sched_id = -1;
cc_unref(monitor, "Remove scheduler's reference to the monitor");
@@ -1212,7 +1213,8 @@
return;
}
- ast_log_dynamic_level(cc_logger_level, "Destroying generic monitor %s with core_id %d\n", gen_mon_pvt->device_name, gen_mon_pvt->core_id);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Destroying generic monitor %s\n",
+ gen_mon_pvt->core_id, gen_mon_pvt->device_name);
if (!(generic_list = find_generic_monitor_instance_list(gen_mon_pvt->device_name))) {
/* If there's no generic list, that means that the monitor is being destroyed
@@ -1353,7 +1355,8 @@
* assigned to them, so we wouldn't want to segfault when we try
* to destroy one of them.
*/
- ast_log_dynamic_level(cc_logger_level, "Calling destructor for monitor %s, core ID %d\n", monitor->interface->device_name, monitor->core_id);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Calling destructor for monitor %s\n",
+ monitor->core_id, monitor->interface->device_name);
if (monitor->interface->monitor_class == AST_CC_EXTENSION_MONITOR) {
cc_extension_monitor_destructor(monitor->private_data);
}
@@ -1834,7 +1837,8 @@
monitor->interface = cc_interface;
monitor->available_timer_id = -1;
ast_cc_copy_config_params(cc_interface->config_params, &cc_data->config_params);
- ast_log_dynamic_level(cc_logger_level, "Created a device cc interface for '%s' with id %d and parent %d\n", cc_interface->device_name, monitor->id, monitor->parent_id);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Created a device cc interface for '%s' with id %d and parent %d\n",
+ monitor->core_id, cc_interface->device_name, monitor->id, monitor->parent_id);
return monitor;
}
@@ -1917,7 +1921,8 @@
AST_LIST_LOCK(cc_interfaces->interface_tree);
AST_LIST_TRAVERSE(cc_interfaces->interface_tree, monitor, next) {
if (!strcmp(monitor->interface->device_name, device_name)) {
- ast_log_dynamic_level(cc_logger_level, "Device %s sent us multiple CC control frames. Ignoring those beyond the first.\n", device_name);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Device %s sent us multiple CC control frames. Ignoring those beyond the first.\n",
+ core_instance->core_id, device_name);
AST_LIST_UNLOCK(cc_interfaces->interface_tree);
cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame");
call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
@@ -2123,7 +2128,8 @@
cc_unref(agent, "Agent init callback failed.");
return NULL;
}
- ast_log_dynamic_level(cc_logger_level, "Created an agent with core_id %d and caller %s\n", agent->core_id, agent->device_name);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Created an agent for caller %s\n",
+ agent->core_id, agent->device_name);
return agent;
}
@@ -2223,7 +2229,8 @@
{
const struct ast_cc_agent *agent = data;
struct cc_generic_agent_pvt *agent_pvt = agent->private_data;
- ast_log_dynamic_level(cc_logger_level, "Queuing change request because offer timer has expired.\n");
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Queuing change request because offer timer has expired.\n",
+ agent->core_id);
agent_pvt->offer_timer_id = -1;
cc_unref((struct ast_cc_agent *)agent, "Remove scheduler's reference to the agent");
ast_cc_failed(agent->core_id, "Generic agent %s offer timer expired", agent->device_name);
@@ -2240,7 +2247,8 @@
ast_assert(agent->cc_params != NULL);
when = ast_get_cc_offer_timer(agent->cc_params) * 1000;
- ast_log_dynamic_level(cc_logger_level, "About to schedule offer timer expiration for %d ms\n", when);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: About to schedule offer timer expiration for %d ms\n",
+ agent->core_id, when);
if ((sched_id = ast_sched_thread_add(cc_sched_thread, when, offer_timer_expire, cc_ref(agent, "Give scheduler an agent ref"))) == -1) {
return -1;
}
@@ -2347,12 +2355,14 @@
if (!(chan = ast_request_and_dial(tech, AST_FORMAT_SLINEAR, NULL, target, recall_timer, &reason, generic_pvt->cid_num, generic_pvt->cid_name))) {
/* Hmm, no channel. Sucks for you, bud.
*/
- ast_log_dynamic_level(cc_logger_level, "Failed to call back %s for reason %d\n", agent->device_name, reason);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Failed to call back %s for reason %d\n",
+ agent->core_id, agent->device_name, reason);
ast_cc_failed(agent->core_id, "Failed to call back device %s/%s", tech, target);
return NULL;
}
if (!ast_strlen_zero(callback_macro)) {
- ast_log_dynamic_level(cc_logger_level, "There's a callback macro configured for agent %s\n", agent->device_name);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: There's a callback macro configured for agent %s\n",
+ agent->core_id, agent->device_name);
if (ast_app_run_macro(NULL, chan, callback_macro, NULL)) {
ast_cc_failed(agent->core_id, "Callback macro to %s failed. Maybe a hangup?", agent->device_name);
ast_hangup(chan);
@@ -2411,7 +2421,7 @@
static void cc_core_instance_destructor(void *data)
{
struct cc_core_instance *core_instance = data;
- ast_log_dynamic_level(cc_logger_level, "Destroying core instance %d\n", core_instance->core_id);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Destroying core instance\n", core_instance->core_id);
if (core_instance->agent) {
cc_unref(core_instance->agent, "Core instance is done with the agent now");
}
@@ -2490,7 +2500,8 @@
int is_valid = 0;
switch (new_state) {
case CC_AVAILABLE:
- ast_log_dynamic_level(cc_logger_level, "Asked to change to state %d? That should never happen.\n", new_state);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Asked to change to state %d? That should never happen.\n",
+ agent->core_id, new_state);
break;
case CC_CALLER_OFFERED:
if (current_state == CC_AVAILABLE) {
@@ -2532,7 +2543,8 @@
is_valid = 1;
break;
default:
- ast_log_dynamic_level(cc_logger_level, "Asked to change to unknown state %d\n", new_state);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Asked to change to unknown state %d\n",
+ agent->core_id, new_state);
break;
}
@@ -2558,7 +2570,8 @@
"Caller: %s\r\n"
"Expires: %u\r\n",
core_instance->core_id, core_instance->agent->device_name, core_instance->agent->cc_params->cc_offer_timer);
- ast_log_dynamic_level(cc_logger_level, "Started the offer timer for the agent!\n");
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Started the offer timer for the agent %s!\n",
+ core_instance->core_id, core_instance->agent->device_name);
return 0;
}
@@ -2801,17 +2814,18 @@
enum cc_state previous_state;
int res;
- ast_log_dynamic_level(cc_logger_level, "Core %d: State change to %d requested. Reason: %s\n", args->core_id, args->state, args->debug);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: State change to %d requested. Reason: %s\n",
+ args->core_id, args->state, args->debug);
if (!(core_instance = find_cc_core_instance(args->core_id))) {
- ast_log_dynamic_level(cc_logger_level, "Unable to find core instance %d\n", args->core_id);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Unable to find core instance.\n", args->core_id);
ast_free(args);
return -1;
}
if (!is_state_change_valid(core_instance->current_state, args->state, core_instance->agent)) {
- ast_log_dynamic_level(cc_logger_level, "Invalid state change requested. Cannot go from %s to %s\n",
- cc_state_to_string(core_instance->current_state), cc_state_to_string(args->state));
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Invalid state change requested. Cannot go from %s to %s\n",
+ args->core_id, cc_state_to_string(core_instance->current_state), cc_state_to_string(args->state));
ast_free(args);
cc_unref(core_instance, "Unref core instance from when it was found earlier");
return -1;
@@ -3084,6 +3098,7 @@
struct ast_cc_monitor *monitor;
struct cc_recall_ds_data *recall_data;
struct ast_str *str = ast_str_create(64);
+ int core_id;
if (!str) {
return -1;
@@ -3097,6 +3112,7 @@
}
recall_data = recall_datastore->data;
interface_tree = cc_ref(recall_data->interface_tree, "Getting ref of recall monitor tree");
+ core_id = recall_data->core_id;
ast_channel_unlock(chan);
AST_LIST_LOCK(interface_tree);
@@ -3105,7 +3121,8 @@
AST_LIST_UNLOCK(interface_tree);
pbx_builtin_setvar_helper(chan, "CC_INTERFACES", ast_str_buffer(str));
- ast_log_dynamic_level(cc_logger_level, "CC_INTERFACES set to %s\n", ast_str_buffer(str));
+ ast_log_dynamic_level(cc_logger_level, "Core %d: CC_INTERFACES set to %s\n",
+ core_id, ast_str_buffer(str));
cc_unref(interface_tree, "Done with monitor tree while setting CC_INTERFACES");
ast_free(str);
@@ -3119,6 +3136,7 @@
struct ast_cc_monitor *monitor_iter;
struct cc_recall_ds_data *recall_data;
struct ast_str *str = ast_str_create(64);
+ int core_id;
if (!str) {
return -1;
@@ -3132,6 +3150,7 @@
}
recall_data = recall_datastore->data;
interface_tree = cc_ref(recall_data->interface_tree, "Get reference to recall data monitor tree");
+ core_id = recall_data->core_id;
ast_channel_unlock(chan);
AST_LIST_LOCK(interface_tree);
@@ -3156,7 +3175,8 @@
AST_LIST_UNLOCK(interface_tree);
pbx_builtin_setvar_helper(chan, "CC_INTERFACES", ast_str_buffer(str));
- ast_log_dynamic_level(cc_logger_level, "CC_INTERFACES set to %s\n", ast_str_buffer(str));
+ ast_log_dynamic_level(cc_logger_level, "Core %d: CC_INTERFACES set to %s\n",
+ core_id, ast_str_buffer(str));
cc_unref(interface_tree, "Done writing the CC_INTERFACES channel variable");
ast_free(str);
@@ -3349,7 +3369,7 @@
if (!core_instance) {
/* Core instance no longer exists or invalid core_id. */
ast_log_dynamic_level(cc_logger_level,
- "Could not find core instance %d for device %s '%s'\n",
+ "Core %d: Could not find core instance for device %s '%s'\n",
failure_data->core_id, failure_data->device_name, failure_data->debug);
ast_free((char *) failure_data->device_name);
ast_free((char *) failure_data->debug);
@@ -3710,16 +3730,19 @@
return -1;
}
- ast_log_dynamic_level(cc_logger_level, "Found core_instance with core_id %d\n", core_instance->core_id);
+ ast_log_dynamic_level(cc_logger_level, "Core %d: Found core_instance for caller %s\n",
+ core_instance->core_id, device_name);
if (strcmp(core_instance->agent->callbacks->type, "generic")) {
- ast_log_dynamic_level(cc_logger_level, "CallCompletionRequest is only for generic agent types.\n");
+ ast_log_dynamic_level(cc_logger_level, "Core %d: CallCompletionRequest is only for generic agent types.\n",
+ core_instance->core_id);
cc_unref(core_instance, "Unref core_instance since CallCompletionRequest was called with native agent");
return -1;
}
if (!ast_cc_request_is_within_limits()) {
- ast_log_dynamic_level(cc_logger_level, "CallCompletionRequest failed. Too many requests in the system\n");
+ ast_log_dynamic_level(cc_logger_level, "Core %d: CallCompletionRequest failed. Too many requests in the system\n",
+ core_instance->core_id);
ast_cc_failed(core_instance->core_id, "Too many CC requests\n");
cc_unref(core_instance, "Unref core_instance since too many CC requests");
return -1;
More information about the asterisk-commits
mailing list