[Freeswitch-svn] [commit] r10389 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event
FreeSWITCH SVN
andrew at freeswitch.org
Thu Nov 13 14:46:58 PST 2008
Author: andrew
Date: Thu Nov 13 17:46:58 2008
New Revision: 10389
Log:
Add support for 'getpid'; a way to return the fake cnode process id on the FreeSWITCH side
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c Thu Nov 13 17:46:58 2008
@@ -63,7 +63,7 @@
struct listener {
int sockfd;
- const struct ei_cnode_s *ec;
+ struct ei_cnode_s *ec;
erlang_pid log_pid;
erlang_pid event_pid;
switch_queue_t *event_queue;
@@ -884,6 +884,10 @@
switch_clear_flag_locked(listener, LFLAG_RUNNING);
ei_x_encode_atom(rbuf, "ok");
goto event_done;
+ } else if (!strncmp(atom, "getpid", MAXATOMLEN)) {
+ ei_x_encode_tuple_header(rbuf, 2);
+ ei_x_encode_atom(rbuf, "ok");
+ ei_x_encode_pid(rbuf, ei_self(listener->ec));
} else {
ei_x_encode_tuple_header(rbuf, 2);
ei_x_encode_atom(rbuf, "error");
@@ -1007,7 +1011,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_unlink\n");
break;
case ERL_EXIT :
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num, msg.from.serial);
+ /* TODO - check if this linked pid is any of the log/event handler processes and cleanup if it is. */
break;
default :
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected msg type %d\n", (int)(msg.msgtype));
More information about the Freeswitch-svn
mailing list