end,
bounce_message_queue(),
State1;
+process_terminated(#{sockmod := SockMod, socket := Socket,
+ stop_reason := {tls, no_certfile}} = State, Reason) ->
+ %% TODO: we probably need to report more TLS errors here
+ ?ERROR_MSG("(~s) Failed to secure c2s connection: ~s",
+ [SockMod:pp(Socket), format_reason(State, Reason)]),
+ State;
process_terminated(State, _Reason) ->
State.
end.
handle_stream_end(Reason, #{server_host := LServer} = State) ->
- ejabberd_hooks:run_fold(s2s_in_closed, LServer, State, [Reason]).
+ State1 = State#{stop_reason => Reason},
+ ejabberd_hooks:run_fold(s2s_in_closed, LServer, State1, [Reason]).
handle_stream_established(State) ->
set_idle_timeout(State#{established => true}).
handle_info(Info, #{server_host := LServer} = State) ->
ejabberd_hooks:run_fold(s2s_in_handle_info, LServer, State, [Info]).
-terminate(Reason, #{auth_domains := AuthDomains}) ->
+terminate(Reason, #{auth_domains := AuthDomains,
+ sockmod := SockMod, socket := Socket} = State) ->
+ case maps:get(stop_reason, State, undefined) of
+ {tls, no_certfile} = Err ->
+ %% TODO: we probably need to report more TLS errors here
+ ?ERROR_MSG("(~s) Failed to secure inbound s2s connection: ~s",
+ [SockMod:pp(Socket), xmpp_stream_in:format_error(Err)]);
+ _ ->
+ ok
+ end,
case Reason of
{process_limit, _} ->
sets:fold(