25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

* src/ejabberd_c2s.erl: Option to prevent the use of Erlang OTP supervisor for transient processes (EJAB-354).

* src/ejabberd_s2s_in.erl: Likewise.
* src/ejabberd_s2s_out.erl: Likewise.
* src/mod_muc/mod_muc_room.erl: Likewise.
* src/configure.ac: Likewise.
* src/configure: Likewise.
* src/Makefile.in: Likewise.
* src/mod_muc/Makefile.in: Likewise.

SVN Revision: 931
This commit is contained in:
Mickaël Rémond 2007-09-14 14:16:36 +00:00
parent b78d8ee55f
commit afec054544
8 changed files with 80 additions and 8 deletions

View File

@ -30,6 +30,10 @@ ifeq (@full_xml@, true)
ERLC_FLAGS+=-DFULL_XML_SUPPORT ERLC_FLAGS+=-DFULL_XML_SUPPORT
endif endif
ifeq (@transient_supervisors@, false)
ERLC_FLAGS+=-DNO_TRANSIENT_SUPERVISORS
endif
prefix = @prefix@ prefix = @prefix@
SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @web@ stringprep @tls@ @odbc@ @ejabberd_zlib@ SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @web@ stringprep @tls@ @odbc@ @ejabberd_zlib@

19
src/configure vendored
View File

@ -310,7 +310,7 @@ ac_includes_default="\
#endif" #endif"
ac_default_prefix=/ ac_default_prefix=/
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE ERLC ac_pt_ERLC ERL ac_pt_ERL ERLANG_CFLAGS ERLANG_LIBS LIBICONV CPP EGREP EXPAT_CFLAGS EXPAT_LIBS ZLIB_CFLAGS ZLIB_LIBS LIBOBJS mod_pubsub make_mod_pubsub mod_irc make_mod_irc mod_muc make_mod_muc mod_proxy65 make_mod_proxy65 eldap make_eldap web make_web tls make_tls odbc make_odbc ejabberd_zlib make_ejabberd_zlib roster_gateway_workaround db_type full_xml SSL_LIBS SSL_CFLAGS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE ERLC ac_pt_ERLC ERL ac_pt_ERL ERLANG_CFLAGS ERLANG_LIBS LIBICONV CPP EGREP EXPAT_CFLAGS EXPAT_LIBS ZLIB_CFLAGS ZLIB_LIBS LIBOBJS mod_pubsub make_mod_pubsub mod_irc make_mod_irc mod_muc make_mod_muc mod_proxy65 make_mod_proxy65 eldap make_eldap web make_web tls make_tls odbc make_odbc ejabberd_zlib make_ejabberd_zlib roster_gateway_workaround db_type transient_supervisors full_xml SSL_LIBS SSL_CFLAGS LTLIBOBJS'
ac_subst_files='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
@ -852,6 +852,7 @@ Optional Features:
--enable-ejabberd_zlib enable ejabberd_zlib (default: yes) --enable-ejabberd_zlib enable ejabberd_zlib (default: yes)
--enable-roster-gateway-workaround Turn on workaround for processing gateway subscriptions (default: no) --enable-roster-gateway-workaround Turn on workaround for processing gateway subscriptions (default: no)
--enable-mssql Use Microsoft SQL Server database (default: no, requires --enable-odbc) --enable-mssql Use Microsoft SQL Server database (default: no, requires --enable-odbc)
--enable-transient_supervisors Use Erlang supervision for transient process (default: yes)
--enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients) --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)
Optional Packages: Optional Packages:
@ -4570,6 +4571,21 @@ else
fi; fi;
# Check whether --enable-transient_supervisors or --disable-transient_supervisors was given.
if test "${enable_transient_supervisors+set}" = set; then
enableval="$enable_transient_supervisors"
case "${enableval}" in
yes) transient_supervisors=true ;;
no) transient_supervisors=false ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-full-xml" >&5
echo "$as_me: error: bad value ${enableval} for --enable-full-xml" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
transient_supervisors=true
fi;
# Check whether --enable-full_xml or --disable-full_xml was given. # Check whether --enable-full_xml or --disable-full_xml was given.
if test "${enable_full_xml+set}" = set; then if test "${enable_full_xml+set}" = set; then
enableval="$enable_full_xml" enableval="$enable_full_xml"
@ -5685,6 +5701,7 @@ s,@ejabberd_zlib@,$ejabberd_zlib,;t t
s,@make_ejabberd_zlib@,$make_ejabberd_zlib,;t t s,@make_ejabberd_zlib@,$make_ejabberd_zlib,;t t
s,@roster_gateway_workaround@,$roster_gateway_workaround,;t t s,@roster_gateway_workaround@,$roster_gateway_workaround,;t t
s,@db_type@,$db_type,;t t s,@db_type@,$db_type,;t t
s,@transient_supervisors@,$transient_supervisors,;t t
s,@full_xml@,$full_xml,;t t s,@full_xml@,$full_xml,;t t
s,@SSL_LIBS@,$SSL_LIBS,;t t s,@SSL_LIBS@,$SSL_LIBS,;t t
s,@SSL_CFLAGS@,$SSL_CFLAGS,;t t s,@SSL_CFLAGS@,$SSL_CFLAGS,;t t

View File

@ -55,6 +55,15 @@ AC_ARG_ENABLE(mssql,
esac],[db_type=generic]) esac],[db_type=generic])
AC_SUBST(db_type) AC_SUBST(db_type)
AC_ARG_ENABLE(transient_supervisors,
[ --enable-transient_supervisors Use Erlang supervision for transient process (default: yes)],
[case "${enableval}" in
yes) transient_supervisors=true ;;
no) transient_supervisors=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-full-xml) ;;
esac],[transient_supervisors=true])
AC_SUBST(transient_supervisors)
AC_ARG_ENABLE(full_xml, AC_ARG_ENABLE(full_xml,
[ --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)], [ --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)],
[case "${enableval}" in [case "${enableval}" in

View File

@ -75,6 +75,15 @@
-define(FSMOPTS, []). -define(FSMOPTS, []).
-endif. -endif.
%% Module start with or without supervisor:
-ifdef(NO_TRANSIENT_SUPERVISORS).
-define(SUPERVISOR_START, gen_fsm:start(ejabberd_c2s, [SockData, Opts],
?FSMOPTS)).
-else.
-define(SUPERVISOR_START, supervisor:start_child(ejabberd_c2s_sup,
[SockData, Opts])).
-endif.
-define(STREAM_HEADER, -define(STREAM_HEADER,
"<?xml version='1.0'?>" "<?xml version='1.0'?>"
"<stream:stream xmlns='jabber:client' " "<stream:stream xmlns='jabber:client' "
@ -97,7 +106,7 @@
%%% API %%% API
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
start(SockData, Opts) -> start(SockData, Opts) ->
supervisor:start_child(ejabberd_c2s_sup, [SockData, Opts]). ?SUPERVISOR_START.
start_link(SockData, Opts) -> start_link(SockData, Opts) ->
gen_fsm:start_link(ejabberd_c2s, [SockData, Opts], ?FSMOPTS). gen_fsm:start_link(ejabberd_c2s, [SockData, Opts], ?FSMOPTS).

View File

@ -57,6 +57,15 @@
-define(FSMOPTS, []). -define(FSMOPTS, []).
-endif. -endif.
%% Module start with or without supervisor:
-ifdef(NO_TRANSIENT_SUPERVISORS).
-define(SUPERVISOR_START, gen_fsm:start(ejabberd_s2s_in, [SockData, Opts],
?FSMOPTS)).
-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'?>" ("<?xml version='1.0'?>"
"<stream:stream " "<stream:stream "
@ -84,7 +93,7 @@
%%% API %%% API
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
start(SockData, Opts) -> start(SockData, Opts) ->
supervisor:start_child(ejabberd_s2s_in_sup, [SockData, Opts]). ?SUPERVISOR_START.
start_link(SockData, Opts) -> start_link(SockData, Opts) ->
gen_fsm:start_link(ejabberd_s2s_in, [SockData, Opts], ?FSMOPTS). gen_fsm:start_link(ejabberd_s2s_in, [SockData, Opts], ?FSMOPTS).

View File

@ -58,6 +58,15 @@
-define(FSMOPTS, []). -define(FSMOPTS, []).
-endif. -endif.
%% Module start with or without supervisor:
-ifdef(NO_TRANSIENT_SUPERVISORS).
-define(SUPERVISOR_START, p1_fsm:start(ejabberd_s2s_out, [From, Host, Type],
?FSMOPTS)).
-else.
-define(SUPERVISOR_START, supervisor:start_child(ejabberd_s2s_out_sup,
[From, Host, Type])).
-endif.
%% Only change this value if you now what your are doing: %% Only change this value if you now what your are doing:
-define(FSMLIMITS,[]). -define(FSMLIMITS,[]).
%% -define(FSMLIMITS, [{max_queue, 2000}]). %% -define(FSMLIMITS, [{max_queue, 2000}]).
@ -86,7 +95,7 @@
%%% API %%% API
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
start(From, Host, Type) -> start(From, Host, Type) ->
supervisor:start_child(ejabberd_s2s_out_sup, [From, Host, Type]). ?SUPERVISOR_START.
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],

View File

@ -15,6 +15,11 @@ ifdef debug
EFLAGS+=+debug_info EFLAGS+=+debug_info
endif endif
ifeq (@transient_supervisors@, false)
EFLAGS+=-DNO_TRANSIENT_SUPERVISORS
endif
OBJS = \ OBJS = \
$(OUTDIR)/mod_muc.beam \ $(OUTDIR)/mod_muc.beam \
$(OUTDIR)/mod_muc_log.beam \ $(OUTDIR)/mod_muc_log.beam \

View File

@ -94,16 +94,26 @@
-define(FSMOPTS, []). -define(FSMOPTS, []).
-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 = gen_mod:get_module_proc(ServerHost, ejabberd_mod_muc_sup), ?SUPERVISOR_START.
supervisor:start_child(
Supervisor, [Host, ServerHost, Access, Room, HistorySize, RoomShaper,
Creator, Nick, DefRoomOpts]).
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), Supervisor = gen_mod:get_module_proc(ServerHost, ejabberd_mod_muc_sup),