From 345d5c79ba39ea283113e6b042221137a43189a3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 15 Feb 2008 20:33:16 +0000 Subject: [PATCH] can you seg me now? git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7629 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_event_multicast/mod_event_multicast.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 5896b66b81..87182742a0 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -145,14 +145,18 @@ static void event_handler(switch_event_t *event) size_t len; uint8_t send = 0; - buf = (char *) malloc(MULTICAST_BUFFSIZE); - switch_assert(buf); + if (globals.running != 1) { + return; + } if (event->subclass && !strcmp(event->subclass->name, MULTICAST_EVENT)) { /* ignore our own events to avoid ping pong */ return; } + buf = (char *) malloc(MULTICAST_BUFFSIZE); + switch_assert(buf); + if (globals.event_list[(uint8_t) SWITCH_EVENT_ALL]) { send = 1; } else if ((globals.event_list[(uint8_t) event->event_id])) { @@ -250,8 +254,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown) if (globals.udp_socket) { switch_socket_shutdown(globals.udp_socket, SWITCH_SHUTDOWN_READWRITE); - switch_socket_close(globals.udp_socket); - globals.udp_socket = NULL; } if (globals.running == 1) { @@ -262,6 +264,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown) } } + if (globals.udp_socket) { + switch_socket_close(globals.udp_socket); + globals.udp_socket = NULL; + } + switch_core_hash_destroy(&globals.event_hash); return SWITCH_STATUS_SUCCESS;