aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-06-15 16:49:34 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-06-15 16:49:34 +0000
commit416c0d88788e4c5e7b6129b47184ee3cb7b99ea3 (patch)
tree3e0e15763076bb6aa6b3576e908989b31f6cfe03 /main
parent2964f0b2162c32cb18bd8deb2743cdc5952c4d06 (diff)
Merged revisions 323669-323670 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r323669 | rmudgett | 2011-06-15 11:43:18 -0500 (Wed, 15 Jun 2011) | 21 lines [regression] Voicemail MWI is no longer sent. When leaving a voicemail, the MWI message is never sent. The same thing happens when checking a voicemail and marking it as read. If you restart Asterisk, everything comes up at that state correctly, but changes to the messages in voicemail causes the light to not be set appropriately. Very easy to reproduce. * Made ast_event_check_subscriber() return TRUE if there are ANY subscribers to an event type when there are no restricting ie values passed. This allows an event being queued to be queued. (closes issue ASTERISK-18002) Reported by: lmadsen Tested by: lmadsen, irroot Patches: jira_asterisk_18002_v1.8.patch uploaded by rmudgett (License #5621) (closes issue ASTERISK-18019) ........ r323670 | rmudgett | 2011-06-15 11:43:31 -0500 (Wed, 15 Jun 2011) | 7 lines Add a test to the event unit tests to catch ASTERISK-18002. The new tests check to see if there are ANY subscribers to the event type when ast_event_check_subscriber() is not passed any specific ie values. (issue ASTERISK-18002) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@323671 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/event.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/main/event.c b/main/event.c
index 81dd7c96f..fad8e66ee 100644
--- a/main/event.c
+++ b/main/event.c
@@ -444,12 +444,14 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type typ
};
const enum ast_event_type event_types[] = { type, AST_EVENT_ALL };
int i;
+ int want_specific_event;/* TRUE if looking for subscribers wanting specific parameters. */
if (type >= AST_EVENT_TOTAL) {
ast_log(LOG_ERROR, "%u is an invalid type!\n", type);
return res;
}
+ want_specific_event = 0;
va_start(ap, type);
for (ie_type = va_arg(ap, enum ast_event_ie_type);
ie_type != AST_EVENT_IE_END;
@@ -492,6 +494,7 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type typ
}
if (insert) {
+ want_specific_event = 1;
AST_LIST_INSERT_TAIL(&check_ie_vals.ie_vals, ie_value, entry);
} else {
ast_log(LOG_WARNING, "Unsupported PLTYPE(%d)\n", ie_value->ie_pltype);
@@ -501,17 +504,22 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type typ
for (i = 0; i < ARRAY_LEN(event_types); i++) {
AST_RWDLLIST_RDLOCK(&ast_event_subs[event_types[i]]);
- AST_RWDLLIST_TRAVERSE(&ast_event_subs[event_types[i]], sub, entry) {
- AST_LIST_TRAVERSE(&sub->ie_vals, ie_val, entry) {
- if (!match_sub_ie_val_to_event(ie_val, &check_ie_vals)) {
- /* The current subscription ie did not match an event ie. */
+ if (want_specific_event) {
+ AST_RWDLLIST_TRAVERSE(&ast_event_subs[event_types[i]], sub, entry) {
+ AST_LIST_TRAVERSE(&sub->ie_vals, ie_val, entry) {
+ if (!match_sub_ie_val_to_event(ie_val, &check_ie_vals)) {
+ /* The current subscription ie did not match an event ie. */
+ break;
+ }
+ }
+ if (!ie_val) {
+ /* Everything matched. A subscriber is looking for this event. */
break;
}
}
- if (!ie_val) {
- /* Everything matched. A subscriber is looking for this event. */
- break;
- }
+ } else {
+ /* Just looking to see if there are ANY subscribers to the event type. */
+ sub = AST_RWLIST_FIRST(&ast_event_subs[event_types[i]]);
}
AST_RWDLLIST_UNLOCK(&ast_event_subs[event_types[i]]);
if (sub) {