mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-21 01:01:02 +00:00
Fix a bug where we tried to send events out when no sessions container was present.
This commit stops a warning message (user_data is NULL) from getting output when manager events get sent before manager is initialized. This happens because manager is initialized *after* modules are loaded and the act of loading modules triggers manager events. (issue #14974) Reported by: pj git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190586 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3511,7 +3511,6 @@ int __manager_event(int category, const char *event,
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
struct ast_str *buf;
|
struct ast_str *buf;
|
||||||
struct ao2_iterator i;
|
|
||||||
|
|
||||||
if (!(buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE))) {
|
if (!(buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE))) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -3546,6 +3545,8 @@ int __manager_event(int category, const char *event,
|
|||||||
append_event(ast_str_buffer(buf), category);
|
append_event(ast_str_buffer(buf), category);
|
||||||
|
|
||||||
/* Wake up any sleeping sessions */
|
/* Wake up any sleeping sessions */
|
||||||
|
if (sessions) {
|
||||||
|
struct ao2_iterator i;
|
||||||
i = ao2_iterator_init(sessions, 0);
|
i = ao2_iterator_init(sessions, 0);
|
||||||
while ((session = ao2_iterator_next(&i))) {
|
while ((session = ao2_iterator_next(&i))) {
|
||||||
ao2_lock(session);
|
ao2_lock(session);
|
||||||
@@ -3562,6 +3563,7 @@ int __manager_event(int category, const char *event,
|
|||||||
ao2_unlock(session);
|
ao2_unlock(session);
|
||||||
unref_mansession(session);
|
unref_mansession(session);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AST_RWLIST_RDLOCK(&manager_hooks);
|
AST_RWLIST_RDLOCK(&manager_hooks);
|
||||||
AST_RWLIST_TRAVERSE(&manager_hooks, hook, list) {
|
AST_RWLIST_TRAVERSE(&manager_hooks, hook, list) {
|
||||||
|
|||||||
Reference in New Issue
Block a user