mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
399d170a78
* src/Makefile.win32: Likewise * src/Makefile.in: Likewise * src/configure.ac: Likewise * src/jlib.hrl: Likewise * src/ejabberd.hrl: Added the ejabberd URL SVN Revision: 666
58 lines
1.7 KiB
Erlang
58 lines
1.7 KiB
Erlang
%%%----------------------------------------------------------------------
|
|
%%% File : mod_proxy65.erl
|
|
%%% Author : Evgeniy Khramtsov <xram@jabber.ru>
|
|
%%% Purpose : Main supervisor.
|
|
%%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru>
|
|
%%% Id : $Id$
|
|
%%%----------------------------------------------------------------------
|
|
|
|
-module(mod_proxy65).
|
|
-author('xram@jabber.ru').
|
|
|
|
-behaviour(gen_mod).
|
|
-behaviour(supervisor).
|
|
|
|
%% gen_mod callbacks.
|
|
-export([start/2, stop/1]).
|
|
|
|
%% supervisor callbacks.
|
|
-export([init/1]).
|
|
|
|
%% API.
|
|
-export([start_link/2]).
|
|
|
|
-define(PROCNAME, ejabberd_mod_proxy65).
|
|
|
|
start(Host, Opts) ->
|
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
|
ChildSpec = {
|
|
Proc, {?MODULE, start_link, [Host, Opts]},
|
|
transient, infinity, supervisor, [?MODULE]
|
|
},
|
|
supervisor:start_child(ejabberd_sup, ChildSpec).
|
|
|
|
stop(Host) ->
|
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
|
supervisor:terminate_child(ejabberd_sup, Proc),
|
|
supervisor:delete_child(ejabberd_sup, Proc).
|
|
|
|
start_link(Host, Opts) ->
|
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
|
supervisor:start_link({local, Proc}, ?MODULE, [Host, Opts]).
|
|
|
|
init([Host, Opts]) ->
|
|
Service =
|
|
{mod_proxy65_service, {mod_proxy65_service, start_link, [Host, Opts]},
|
|
transient, 5000, worker, [mod_proxy65_service]},
|
|
StreamSupervisor =
|
|
{ejabberd_mod_proxy65_sup,
|
|
{ejabberd_tmp_sup, start_link,
|
|
[gen_mod:get_module_proc(Host, ejabberd_mod_proxy65_sup),
|
|
mod_proxy65_stream]},
|
|
transient, infinity, supervisor, [ejabberd_tmp_sup]},
|
|
StreamManager =
|
|
{mod_proxy65_sm, {mod_proxy65_sm, start_link, [Host, Opts]},
|
|
transient, 5000, worker, [mod_proxy65_sm]},
|
|
{ok, {{one_for_one, 10, 1},
|
|
[StreamManager, StreamSupervisor, Service]}}.
|