]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add multicast event module
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Feb 2006 21:13:53 +0000 (21:13 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Feb 2006 21:13:53 +0000 (21:13 +0000)
This does 2 things when loaded:

1) All events are serialized and sent to the multicast destination.
2) Any serialized event received on the socket will be reconstituted into
   an event and fired on the local box

So, if you make another local event handler listen for the custom event from
mod_event_multicast "multicast::event" you will be able to react to events
on other instances of FreeSWITCH

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@616 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/modules.conf
src/include/switch_apr.h
src/mod/event_handlers/mod_event_test/mod_event_test.c

index fb67358a638deeb23af9122e2a2eb1af7ef0a88a..92c122a09969096a34e1c7cea65f3f60986d23ef 100644 (file)
@@ -7,6 +7,7 @@
 ; Full paths will be taken "as is" (eg /some/dir/mymod.so)
 
 ; Event Handlers
+;load => mod_event_multicast
 load => mod_zeroconf
 load => mod_xmpp_event
 
index a9e58b2ffc3074141a5e158477ab7a569d599611..e4943de40a1b8dcffb1659ed7728adc4b86efb1b 100644 (file)
@@ -85,6 +85,15 @@ extern "C" {
 /** Structure for referencing files. */
 typedef apr_file_t switch_file_t;
 
+#define SWITCH_SO_LINGER APR_SO_LINGER
+#define SWITCH_SO_KEEPALIVE APR_SO_KEEPALIVE
+#define SWITCH_SO_DEBUG APR_SO_DEBUG
+#define SWITCH_SO_NONBLOCK APR_SO_NONBLOCK
+#define SWITCH_SO_REUSEADDR APR_SO_REUSEADDR
+#define SWITCH_SO_SNDBUF APR_SO_SNDBUF
+#define SWITCH_SO_RCVBUF APR_SO_RCVBUF
+#define SWITCH_SO_DISCONNECTED APR_SO_DISCONNECTED
+
 /**
  * @defgroup switch_file_permissions File Permissions flags 
  * @ingroup switch_file_io
index 761ca0e6ccac816545e6619adcec36ca1cd1a0a1..3383aa22f18f20188bbd9c7584894d901e7ca53f 100644 (file)
@@ -33,6 +33,9 @@
 
 static const char modname[] = "mod_event_test";
 
+//#define TORTURE_ME
+
+
 static void event_handler(switch_event *event)
 {
        char buf[1024];
@@ -49,6 +52,7 @@ static void event_handler(switch_event *event)
 }
 
 
+
 static switch_loadable_module_interface event_test_module_interface = {
        /*.module_name */ modname,
        /*.endpoint_interface */ NULL,
@@ -61,8 +65,6 @@ static switch_loadable_module_interface event_test_module_interface = {
 #define MY_EVENT_COOL "test::cool"
 
 
-//#define TORTURE_ME
-
 #ifdef TORTURE_ME
 #define TTHREADS 500
 static int THREADS = 0;
@@ -113,13 +115,14 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
                return SWITCH_STATUS_GENERR;
        }
-#ifdef TORTURE_ME
+
        if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
                SWITCH_STATUS_SUCCESS) {
                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
                return SWITCH_STATUS_GENERR;
        }
 
+#ifdef TORTURE_ME
        if (1) {
                int x = 0;
                for (x = 0; x < TTHREADS; x++) {