[Freeswitch-svn] [commit] r7629 - freeswitch/trunk/src/mod/event_handlers/mod_event_multicast

Freeswitch SVN anthm at freeswitch.org
Fri Feb 15 15:33:16 EST 2008


Author: anthm
Date: Fri Feb 15 15:33:16 2008
New Revision: 7629

Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c

Log:
can you seg me now?

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	Fri Feb 15 15:33:16 2008
@@ -145,14 +145,18 @@
 	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 @@
 
 	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 @@
 		}
 	}
 
+	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;



More information about the Freeswitch-svn mailing list