diff options
author | Alexey Shchepin <alexey@process-one.net> | 2006-09-25 13:36:41 +0000 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2006-09-25 13:36:41 +0000 |
commit | 3ab30f34fbfc40f5c7457e1da28ec525ce467d13 (patch) | |
tree | 6780efa2f5eee9a5860ce6af980d2751ac2fb0cd /src | |
parent | * src/msgs/cs.msg: Updated Czech translation and removed unused (diff) |
* src/ejabberd_s2s.erl: Added incoming-s2s-number and
outgoing-s2s-number ejabberdctl commands
SVN Revision: 633
Diffstat (limited to 'src')
-rw-r--r-- | src/ejabberd_s2s.erl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ejabberd_s2s.erl b/src/ejabberd_s2s.erl index f5aac6b8a..c3fbf6491 100644 --- a/src/ejabberd_s2s.erl +++ b/src/ejabberd_s2s.erl @@ -19,7 +19,9 @@ get_key/1, try_register/1, remove_connection/1, - dirty_get_connections/0]). + dirty_get_connections/0, + ctl_process/2 + ]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -27,6 +29,7 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). +-include("ejabberd_ctl.hrl"). -record(s2s, {fromto, pid, key}). -record(state, {}). @@ -112,6 +115,10 @@ init([]) -> {attributes, record_info(fields, s2s)}]), mnesia:add_table_copy(s2s, node(), ram_copies), mnesia:subscribe(system), + ejabberd_ctl:register_commands( + [{"incoming-s2s-number", "print a number of incoming s2s connections"}, + {"outgoing-s2s-number", "print a number of outgoing s2s connections"}], + ?MODULE, ctl_process), {ok, #state{}}. %%-------------------------------------------------------------------- @@ -240,6 +247,17 @@ find_connection(From, To) -> send_element(Pid, El) -> Pid ! {send_element, El}. +ctl_process(_Val, ["incoming-s2s-number"]) -> + N = length(supervisor:which_children(ejabberd_s2s_in_sup)), + io:format("~p~n", [N]), + {stop, ?STATUS_SUCCESS}; +ctl_process(_Val, ["outgoing-s2s-number"]) -> + N = length(supervisor:which_children(ejabberd_s2s_out_sup)), + io:format("~p~n", [N]), + {stop, ?STATUS_SUCCESS}; +ctl_process(Val, _Args) -> + Val. + update_tables() -> case catch mnesia:table_info(s2s, attributes) of [fromto, node, key] -> |