[asterisk-commits] file: branch file/sorceryx3 r386188 - /team/file/sorceryx3/main/sorcery.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Apr 21 16:19:37 CDT 2013
Author: file
Date: Sun Apr 21 16:19:33 2013
New Revision: 386188
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386188
Log:
Only push observers notifications when observers are present.
Modified:
team/file/sorceryx3/main/sorcery.c
Modified: team/file/sorceryx3/main/sorcery.c
URL: http://svnview.digium.com/svn/asterisk/team/file/sorceryx3/main/sorcery.c?view=diff&rev=386188&r1=386187&r2=386188
==============================================================================
--- team/file/sorceryx3/main/sorcery.c (original)
+++ team/file/sorceryx3/main/sorcery.c Sun Apr 21 16:19:33 2013
@@ -1198,7 +1198,8 @@
return -1;
}
- if ((object_wizard = ao2_callback(object_type->wizards, 0, sorcery_wizard_create, &sdetails))) {
+ if ((object_wizard = ao2_callback(object_type->wizards, 0, sorcery_wizard_create, &sdetails)) &&
+ ao2_container_count(object_type->observers)) {
struct sorcery_observer_invocation *invocation = sorcery_observer_invocation_alloc(object_type->observers, object);
if (invocation && ast_taskprocessor_push(object_type->serializer, sorcery_observers_notify_create, invocation)) {
@@ -1256,7 +1257,8 @@
return -1;
}
- if ((object_wizard = ao2_callback(object_type->wizards, 0, sorcery_wizard_update, &sdetails))) {
+ if ((object_wizard = ao2_callback(object_type->wizards, 0, sorcery_wizard_update, &sdetails)) &&
+ ao2_container_count(object_type->observers)) {
struct sorcery_observer_invocation *invocation = sorcery_observer_invocation_alloc(object_type->observers, object);
if (invocation && ast_taskprocessor_push(object_type->serializer, sorcery_observers_notify_update, invocation)) {
@@ -1314,7 +1316,8 @@
return -1;
}
- if ((object_wizard = ao2_callback(object_type->wizards, 0, sorcery_wizard_delete, &sdetails))) {
+ if ((object_wizard = ao2_callback(object_type->wizards, 0, sorcery_wizard_delete, &sdetails)) &&
+ ao2_container_count(object_type->observers)) {
struct sorcery_observer_invocation *invocation = sorcery_observer_invocation_alloc(object_type->observers, object);
if (invocation && ast_taskprocessor_push(object_type->serializer, sorcery_observers_notify_delete, invocation)) {
@@ -1379,4 +1382,4 @@
}
ao2_callback(object_type->observers, OBJ_NODATA | OBJ_UNLINK, sorcery_observer_remove, callbacks);
-}
+}
More information about the asterisk-commits
mailing list