Dump cache of published events when a node joins the cluster.

Also use a more reliable method for stopping the poll() thread.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@359053 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2012-03-13 23:45:23 +00:00
parent 0da9d71905
commit ac53c0d94e
4 changed files with 116 additions and 6 deletions

View File

@@ -232,8 +232,15 @@ static void ast_event_cb(const struct ast_event *ast_event, void *data)
goto return_event_free;
}
ais_res = saEvtEventPublish(event_handle,
ast_event, ast_event_get_size(ast_event), &event_id);
for (;;) {
ais_res = saEvtEventPublish(event_handle,
ast_event, ast_event_get_size(ast_event), &event_id);
if (ais_res != SA_AIS_ERR_TRY_AGAIN) {
break;
}
sched_yield();
}
if (ais_res != SA_AIS_OK) {
ast_log(LOG_ERROR, "Error publishing event: %s\n", ais_err2str(ais_res));
goto return_event_free;
@@ -305,6 +312,22 @@ static struct ast_cli_entry ais_cli[] = {
AST_CLI_DEFINE(ais_evt_show_event_channels, "Show configured event channels"),
};
void ast_ais_evt_membership_changed(void)
{
struct event_channel *ec;
AST_RWLIST_RDLOCK(&event_channels);
AST_RWLIST_TRAVERSE(&event_channels, ec, entry) {
struct publish_event *pe;
AST_LIST_TRAVERSE(&ec->publish_events, pe, entry) {
ast_debug(1, "Dumping cache for event channel '%s'\n", ec->name);
ast_event_dump_cache(pe->sub);
}
}
AST_RWLIST_UNLOCK(&event_channels);
}
static void add_publish_event(struct event_channel *event_channel, const char *event_type)
{
int i;