25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

ejabberd_systemd: Add a few debug messages

This commit is contained in:
Holger Weiss 2023-08-09 01:58:48 +02:00
parent 6c7e85d3d8
commit caf3807bcc

View File

@ -117,7 +117,7 @@ handle_cast(Msg, State) ->
{noreply, State}. {noreply, State}.
-spec handle_info(ping_watchdog | term(), state()) -> {noreply, state()}. -spec handle_info(ping_watchdog | term(), state()) -> {noreply, state()}.
handle_info(ping_watchdog , #state{interval = Interval} = State) handle_info(ping_watchdog, #state{interval = Interval} = State)
when is_integer(Interval), Interval > 0 -> when is_integer(Interval), Interval > 0 ->
try notify(State, <<"WATCHDOG=1">>) try notify(State, <<"WATCHDOG=1">>)
catch _:Err -> catch _:Err ->
@ -169,10 +169,12 @@ maybe_start_timer(State) ->
-spec start_timer(state()) -> state(). -spec start_timer(state()) -> state().
start_timer(#state{interval = Interval} = State) -> start_timer(#state{interval = Interval} = State) ->
?DEBUG("Pinging watchdog in ~B milliseconds", [Interval]),
State#state{timer = erlang:send_after(Interval, self(), ping_watchdog)}. State#state{timer = erlang:send_after(Interval, self(), ping_watchdog)}.
-spec cancel_timer(state()) -> ok. -spec cancel_timer(state()) -> ok.
cancel_timer(#state{timer = Timer}) -> cancel_timer(#state{timer = Timer}) ->
?DEBUG("Cancelling watchdog timer", []),
misc:cancel_timer(Timer). misc:cancel_timer(Timer).
-spec notify(state(), binary()) -> ok. -spec notify(state(), binary()) -> ok.
@ -183,4 +185,5 @@ notify(#state{socket = Socket, destination = Destination},
-spec cast_notification(binary()) -> ok. -spec cast_notification(binary()) -> ok.
cast_notification(Notification) -> cast_notification(Notification) ->
?DEBUG("Closing NOTIFY_SOCKET", []),
gen_server:cast(?MODULE, {notify, Notification}). gen_server:cast(?MODULE, {notify, Notification}).