[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r242021 - in /team/group/CC...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 21 10:50:46 CST 2010
Author: mmichelson
Date: Thu Jan 21 10:50:45 2010
New Revision: 242021
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242021
Log:
Write the new destructor for generic monitors.
Modified:
team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
team/group/CCSS_Monitor_Restructure/main/ccss.c
Modified: team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h?view=diff&rev=242021&r1=242020&r2=242021
==============================================================================
--- team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h (original)
+++ team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h Thu Jan 21 10:50:45 2010
@@ -638,6 +638,7 @@
* the private_data itself.
*/
void (*destructor)(struct ast_cc_monitor *monitor);
+ void (*destructor2)(void *private_data);
/*!
* \brief Destroy private data for a specific monitor instance.
*
Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=242021&r1=242020&r2=242021
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Thu Jan 21 10:50:45 2010
@@ -923,6 +923,7 @@
* Monitor callbacks
*/
const struct ast_cc_monitor_callbacks *callbacks;
+ void *private_data;
AST_DLLIST_ENTRY(cc_monitor) next;
};
@@ -1011,6 +1012,7 @@
static int cc_generic_monitor_status_response(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate);
static int cc_generic_monitor_unsuspend2(struct cc_monitor *monitor);
static int cc_generic_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, const int core_id, int *sched_id);
+static void cc_generic_monitor_destructor2(void *private_data);
static void cc_generic_monitor_destructor(struct ast_cc_monitor *monitor);
static void cc_generic_monitor_instance_destructor(const int core_id);
@@ -1022,6 +1024,7 @@
.status_response = cc_generic_monitor_status_response,
.unsuspend2 = cc_generic_monitor_unsuspend2,
.cancel_available_timer = cc_generic_monitor_cancel_available_timer,
+ .destructor2 = cc_generic_monitor_destructor2,
.destructor = cc_generic_monitor_destructor,
.instance_destructor = cc_generic_monitor_instance_destructor,
};
@@ -1317,6 +1320,31 @@
return 0;
}
+static void cc_generic_monitor_destructor2(void *private_data)
+{
+ struct generic_monitor_pvt *gen_mon_pvt = private_data;
+ struct generic_monitor_instance_list *generic_list = find_generic_monitor_instance_list(gen_mon_pvt->device_name);
+ struct generic_monitor_instance *generic_instance;
+
+ if (!generic_list) {
+ /* This will likely be the case if this gets called before we've had an adequate
+ * opportunity to actually create the generic monitor. As such, there has been
+ * no generic list created yet.
+ */
+ return;
+ }
+
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&generic_list->list, generic_instance, next) {
+ if (generic_instance->monitor->core_id == gen_mon_pvt->core_id) {
+ AST_LIST_REMOVE_CURRENT(next);
+ ast_free(generic_instance);
+ break;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+ cc_unref(generic_list, "Done with generic list in generic monitor destructor");
+}
+
static void cc_generic_monitor_destructor(struct ast_cc_monitor *monitor)
{
struct generic_monitor_pvt *gen_mon_pvt = monitor->private_data;
@@ -1351,6 +1379,7 @@
static void cc_monitor_destroy(struct cc_monitor *monitor)
{
+ monitor->callbacks->destructor2(monitor->private_data);
cc_unref(monitor->interface, "Unreffing tree's reference to interface");
ast_free(monitor->dialable_name);
ast_free(monitor);
@@ -2323,7 +2352,9 @@
if (core_instance->agent) {
cc_unref(core_instance->agent, "Core instance is done with the agent now");
}
- cc_unref(core_instance->monitors, "Core instance is done with interface list");
+ if (core_instance->monitors) {
+ core_instance->monitors = cc_unref(core_instance->monitors, "Core instance is done with interface list");
+ }
}
static struct cc_core_instance *cc_core_init_instance(struct ast_channel *caller_chan,
More information about the asterisk-commits
mailing list