aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-03-29 12:14:31 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-03-29 12:14:31 +0300
commit9373ad20ca0ffa457062e3c5c4593bc67ee23c2b (patch)
treeba5fb93143328ba9efe73a089cb60349db738286 /src/ejabberd.erl
parentRemove unused variable (diff)
Don't produce a crash dump during intentional exit
Also halt faster without relying on timeouts for buffers flushing
Diffstat (limited to 'src/ejabberd.erl')
-rw-r--r--src/ejabberd.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ejabberd.erl b/src/ejabberd.erl
index 356fd66c7..4740bd034 100644
--- a/src/ejabberd.erl
+++ b/src/ejabberd.erl
@@ -25,6 +25,7 @@
-module(ejabberd).
-author('alexey@process-one.net').
+-compile({no_auto_import, [{halt, 0}]}).
-protocol({xep, 4, '2.9'}).
-protocol({xep, 86, '1.0'}).
@@ -36,7 +37,7 @@
-protocol({xep, 243, '1.0'}).
-protocol({xep, 270, '1.0'}).
--export([start/0, stop/0, start_app/1, start_app/2,
+-export([start/0, stop/0, halt/0, start_app/1, start_app/2,
get_pid_file/0, check_app/1, module_name/1]).
-include("logger.hrl").
@@ -49,6 +50,11 @@ stop() ->
application:stop(ejabberd).
%%ejabberd_cover:stop().
+halt() ->
+ application:stop(lager),
+ application:stop(sasl),
+ erlang:halt(1, [{flush, true}]).
+
%% @spec () -> false | string()
get_pid_file() ->
case os:getenv("EJABBERD_PID_PATH") of
@@ -131,8 +137,7 @@ exit_or_halt(Reason, StartFlag) ->
?CRITICAL_MSG(Reason, []),
if StartFlag ->
%% Wait for the critical message is written in the console/log
- timer:sleep(1000),
- halt(string:substr(lists:flatten(Reason), 1, 199));
+ halt();
true ->
erlang:error(application_start_failed)
end.