mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Remove supervisor option, disable it for c2s and muc
This commit is contained in:
parent
fec7e47169
commit
341be9b682
@ -83,14 +83,6 @@ AC_ARG_ENABLE(roster_gateway_workaround,
|
|||||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-roster-gateway-workaround) ;;
|
*) AC_MSG_ERROR(bad value ${enableval} for --enable-roster-gateway-workaround) ;;
|
||||||
esac],[roster_gateway_workaround=false])
|
esac],[roster_gateway_workaround=false])
|
||||||
|
|
||||||
AC_ARG_ENABLE(transient_supervisors,
|
|
||||||
[AC_HELP_STRING([--disable-transient-supervisors], [disable Erlang supervision for transient processes (default: no)])],
|
|
||||||
[case "${enableval}" in
|
|
||||||
yes) transient_supervisors=true ;;
|
|
||||||
no) transient_supervisors=false ;;
|
|
||||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-transient_supervisors) ;;
|
|
||||||
esac],[transient_supervisors=true])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(full_xml,
|
AC_ARG_ENABLE(full_xml,
|
||||||
[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])],
|
[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
@ -256,7 +248,6 @@ fi
|
|||||||
|
|
||||||
AC_SUBST(hipe)
|
AC_SUBST(hipe)
|
||||||
AC_SUBST(roster_gateway_workaround)
|
AC_SUBST(roster_gateway_workaround)
|
||||||
AC_SUBST(transient_supervisors)
|
|
||||||
AC_SUBST(full_xml)
|
AC_SUBST(full_xml)
|
||||||
AC_SUBST(nif)
|
AC_SUBST(nif)
|
||||||
AC_SUBST(db_type)
|
AC_SUBST(db_type)
|
||||||
|
@ -19,8 +19,6 @@ Cfg = case file:consult("vars.config") of
|
|||||||
Macros = lists:flatmap(
|
Macros = lists:flatmap(
|
||||||
fun({roster_gateway_workaround, true}) ->
|
fun({roster_gateway_workaround, true}) ->
|
||||||
[{d, 'ROSTER_GATEWAY_WORKAROUND'}];
|
[{d, 'ROSTER_GATEWAY_WORKAROUND'}];
|
||||||
({transient_supervisors, false}) ->
|
|
||||||
[{d, 'NO_TRANSIENT_SUPERVISORS'}];
|
|
||||||
({nif, true}) ->
|
({nif, true}) ->
|
||||||
[{d, 'NIF'}];
|
[{d, 'NIF'}];
|
||||||
({db_type, mssql}) ->
|
({db_type, mssql}) ->
|
||||||
|
@ -129,15 +129,6 @@
|
|||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
%% Module start with or without supervisor:
|
|
||||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
|
||||||
-define(SUPERVISOR_START, ?GEN_FSM:start(ejabberd_c2s, [SockData, Opts],
|
|
||||||
fsm_limit_opts(Opts) ++ ?FSMOPTS)).
|
|
||||||
-else.
|
|
||||||
-define(SUPERVISOR_START, supervisor:start_child(ejabberd_c2s_sup,
|
|
||||||
[SockData, Opts])).
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
%% This is the timeout to apply between event when starting a new
|
%% This is the timeout to apply between event when starting a new
|
||||||
%% session:
|
%% session:
|
||||||
-define(C2S_OPEN_TIMEOUT, 60000).
|
-define(C2S_OPEN_TIMEOUT, 60000).
|
||||||
@ -201,7 +192,9 @@
|
|||||||
%%% API
|
%%% API
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
start(SockData, Opts) ->
|
start(SockData, Opts) ->
|
||||||
?SUPERVISOR_START.
|
?GEN_FSM:start(ejabberd_c2s,
|
||||||
|
[SockData, Opts],
|
||||||
|
fsm_limit_opts(Opts) ++ ?FSMOPTS).
|
||||||
|
|
||||||
start_link(SockData, Opts) ->
|
start_link(SockData, Opts) ->
|
||||||
(?GEN_FSM):start_link(ejabberd_c2s,
|
(?GEN_FSM):start_link(ejabberd_c2s,
|
||||||
|
@ -74,21 +74,6 @@
|
|||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
%% Module start with or without supervisor:
|
|
||||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
|
||||||
|
|
||||||
-define(SUPERVISOR_START,
|
|
||||||
p1_fsm:start(ejabberd_s2s_in, [SockData, Opts],
|
|
||||||
?FSMOPTS ++ fsm_limit_opts(Opts))).
|
|
||||||
|
|
||||||
-else.
|
|
||||||
|
|
||||||
-define(SUPERVISOR_START,
|
|
||||||
supervisor:start_child(ejabberd_s2s_in_sup,
|
|
||||||
[SockData, Opts])).
|
|
||||||
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
-define(STREAM_HEADER(Version),
|
-define(STREAM_HEADER(Version),
|
||||||
<<"<?xml version='1.0'?><stream:stream "
|
<<"<?xml version='1.0'?><stream:stream "
|
||||||
"xmlns:stream='http://etherx.jabber.org/stream"
|
"xmlns:stream='http://etherx.jabber.org/stream"
|
||||||
@ -111,7 +96,9 @@
|
|||||||
-define(INVALID_XML_ERR,
|
-define(INVALID_XML_ERR,
|
||||||
xml:element_to_binary(?SERR_XML_NOT_WELL_FORMED)).
|
xml:element_to_binary(?SERR_XML_NOT_WELL_FORMED)).
|
||||||
|
|
||||||
start(SockData, Opts) -> ?SUPERVISOR_START.
|
start(SockData, Opts) ->
|
||||||
|
supervisor:start_child(ejabberd_s2s_in_sup,
|
||||||
|
[SockData, Opts]).
|
||||||
|
|
||||||
start_link(SockData, Opts) ->
|
start_link(SockData, Opts) ->
|
||||||
p1_fsm:start_link(ejabberd_s2s_in, [SockData, Opts],
|
p1_fsm:start_link(ejabberd_s2s_in, [SockData, Opts],
|
||||||
|
@ -86,15 +86,6 @@
|
|||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
%% Module start with or without supervisor:
|
|
||||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
|
||||||
-define(SUPERVISOR_START, p1_fsm:start(ejabberd_s2s_out, [From, Host, Type],
|
|
||||||
fsm_limit_opts() ++ ?FSMOPTS)).
|
|
||||||
-else.
|
|
||||||
-define(SUPERVISOR_START, supervisor:start_child(ejabberd_s2s_out_sup,
|
|
||||||
[From, Host, Type])).
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
-define(FSMTIMEOUT, 30000).
|
-define(FSMTIMEOUT, 30000).
|
||||||
|
|
||||||
%% We do not block on send anymore.
|
%% We do not block on send anymore.
|
||||||
@ -127,7 +118,8 @@
|
|||||||
%%% API
|
%%% API
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
start(From, Host, Type) ->
|
start(From, Host, Type) ->
|
||||||
?SUPERVISOR_START.
|
supervisor:start_child(ejabberd_s2s_out_sup,
|
||||||
|
[From, Host, Type]).
|
||||||
|
|
||||||
start_link(From, Host, Type) ->
|
start_link(From, Host, Type) ->
|
||||||
p1_fsm:start_link(ejabberd_s2s_out, [From, Host, Type],
|
p1_fsm:start_link(ejabberd_s2s_out, [From, Host, Type],
|
||||||
|
@ -105,13 +105,6 @@ init([]) ->
|
|||||||
infinity,
|
infinity,
|
||||||
supervisor,
|
supervisor,
|
||||||
[ejabberd_tmp_sup]},
|
[ejabberd_tmp_sup]},
|
||||||
C2SSupervisor =
|
|
||||||
{ejabberd_c2s_sup,
|
|
||||||
{ejabberd_tmp_sup, start_link, [ejabberd_c2s_sup, ejabberd_c2s]},
|
|
||||||
permanent,
|
|
||||||
infinity,
|
|
||||||
supervisor,
|
|
||||||
[ejabberd_tmp_sup]},
|
|
||||||
S2SInSupervisor =
|
S2SInSupervisor =
|
||||||
{ejabberd_s2s_in_sup,
|
{ejabberd_s2s_in_sup,
|
||||||
{ejabberd_tmp_sup, start_link,
|
{ejabberd_tmp_sup, start_link,
|
||||||
@ -170,7 +163,6 @@ init([]) ->
|
|||||||
Local,
|
Local,
|
||||||
Captcha,
|
Captcha,
|
||||||
ReceiverSupervisor,
|
ReceiverSupervisor,
|
||||||
C2SSupervisor,
|
|
||||||
S2SInSupervisor,
|
S2SInSupervisor,
|
||||||
S2SOutSupervisor,
|
S2SOutSupervisor,
|
||||||
ServiceSupervisor,
|
ServiceSupervisor,
|
||||||
|
@ -91,7 +91,6 @@ start_link(Host, Opts) ->
|
|||||||
[Host, Opts], []).
|
[Host, Opts], []).
|
||||||
|
|
||||||
start(Host, Opts) ->
|
start(Host, Opts) ->
|
||||||
start_supervisor(Host),
|
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
ChildSpec = {Proc, {?MODULE, start_link, [Host, Opts]},
|
ChildSpec = {Proc, {?MODULE, start_link, [Host, Opts]},
|
||||||
temporary, 1000, worker, [?MODULE]},
|
temporary, 1000, worker, [?MODULE]},
|
||||||
@ -99,7 +98,6 @@ start(Host, Opts) ->
|
|||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
Rooms = shutdown_rooms(Host),
|
Rooms = shutdown_rooms(Host),
|
||||||
stop_supervisor(Host),
|
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
gen_server:call(Proc, stop),
|
gen_server:call(Proc, stop),
|
||||||
supervisor:delete_child(ejabberd_sup, Proc),
|
supervisor:delete_child(ejabberd_sup, Proc),
|
||||||
@ -444,19 +442,6 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}.
|
|||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%%% Internal functions
|
%%% Internal functions
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
start_supervisor(Host) ->
|
|
||||||
Proc = gen_mod:get_module_proc(Host,
|
|
||||||
ejabberd_mod_muc_sup),
|
|
||||||
ChildSpec = {Proc,
|
|
||||||
{ejabberd_tmp_sup, start_link, [Proc, mod_muc_room]},
|
|
||||||
permanent, infinity, supervisor, [ejabberd_tmp_sup]},
|
|
||||||
supervisor:start_child(ejabberd_sup, ChildSpec).
|
|
||||||
|
|
||||||
stop_supervisor(Host) ->
|
|
||||||
Proc = gen_mod:get_module_proc(Host,
|
|
||||||
ejabberd_mod_muc_sup),
|
|
||||||
supervisor:terminate_child(ejabberd_sup, Proc),
|
|
||||||
supervisor:delete_child(ejabberd_sup, Proc).
|
|
||||||
|
|
||||||
do_route(Host, ServerHost, Access, HistorySize, RoomShaper,
|
do_route(Host, ServerHost, Access, HistorySize, RoomShaper,
|
||||||
From, To, Packet, DefRoomOpts) ->
|
From, To, Packet, DefRoomOpts) ->
|
||||||
|
@ -70,32 +70,19 @@
|
|||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
%% Module start with or without supervisor:
|
|
||||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
|
||||||
-define(SUPERVISOR_START,
|
|
||||||
gen_fsm:start(?MODULE, [Host, ServerHost, Access, Room, HistorySize,
|
|
||||||
RoomShaper, Creator, Nick, DefRoomOpts],
|
|
||||||
?FSMOPTS)).
|
|
||||||
-else.
|
|
||||||
-define(SUPERVISOR_START,
|
|
||||||
Supervisor = gen_mod:get_module_proc(ServerHost, ejabberd_mod_muc_sup),
|
|
||||||
supervisor:start_child(
|
|
||||||
Supervisor, [Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
|
||||||
Creator, Nick, DefRoomOpts])).
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%% API
|
%%% API
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
start(Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
start(Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
||||||
Creator, Nick, DefRoomOpts) ->
|
Creator, Nick, DefRoomOpts) ->
|
||||||
?SUPERVISOR_START.
|
gen_fsm:start(?MODULE, [Host, ServerHost, Access, Room, HistorySize,
|
||||||
|
RoomShaper, Creator, Nick, DefRoomOpts],
|
||||||
|
?FSMOPTS).
|
||||||
|
|
||||||
start(Host, ServerHost, Access, Room, HistorySize, RoomShaper, Opts) ->
|
start(Host, ServerHost, Access, Room, HistorySize, RoomShaper, Opts) ->
|
||||||
Supervisor = gen_mod:get_module_proc(ServerHost, ejabberd_mod_muc_sup),
|
gen_fsm:start(?MODULE, [Host, ServerHost, Access, Room, HistorySize,
|
||||||
supervisor:start_child(
|
RoomShaper, Opts],
|
||||||
Supervisor, [Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
?FSMOPTS).
|
||||||
Opts]).
|
|
||||||
|
|
||||||
start_link(Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
start_link(Host, ServerHost, Access, Room, HistorySize, RoomShaper,
|
||||||
Creator, Nick, DefRoomOpts) ->
|
Creator, Nick, DefRoomOpts) ->
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
%% Macros
|
%% Macros
|
||||||
{roster_gateway_workaround, @roster_gateway_workaround@}.
|
{roster_gateway_workaround, @roster_gateway_workaround@}.
|
||||||
{transient_supervisors, @transient_supervisors@}.
|
|
||||||
{full_xml, @full_xml@}.
|
{full_xml, @full_xml@}.
|
||||||
{nif, @nif@}.
|
{nif, @nif@}.
|
||||||
{db_type, @db_type@}.
|
{db_type, @db_type@}.
|
||||||
|
Loading…
Reference in New Issue
Block a user