mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 06:18:35 +00:00
Add multicast event module
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
This commit is contained in:
1 parent
93d822b66f
commit
847b7160bd
3 files changed
+16
-3
No files matched your search
@@ -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++) {
|
||||
|
||||
Reference in new issue
Block a user