MODAPP-264 prevent multiple bindings of the same event_hooks to make code simpler in mod_limit

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13113 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-04-22 15:02:32 +00:00
parent eafbfb388c
commit dd61d20987
2 changed files with 8 additions and 13 deletions
+1 -1
View File
@@ -183,12 +183,12 @@ extern switch_io_event_hooks_t switch_core_session_get_event_hooks(switch_core_s
assert(_NAME != NULL); \
for (ptr = session->event_hooks._NAME; ptr && ptr->next; ptr = ptr->next) \
if (ptr->_NAME == _NAME) return SWITCH_STATUS_FALSE; \
if (ptr && ptr->_NAME == _NAME) return SWITCH_STATUS_FALSE; \
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) { \
hook->_NAME = _NAME ; \
if (! session->event_hooks._NAME ) { \
session->event_hooks._NAME = hook; \
} else { \
for (ptr = session->event_hooks._NAME; ptr && ptr->next; ptr = ptr->next); \
ptr->next = hook; \
} \
return SWITCH_STATUS_SUCCESS; \