diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl index eb508da14..9abc0d017 100644 --- a/src/ejabberd_s2s_out.erl +++ b/src/ejabberd_s2s_out.erl @@ -254,10 +254,12 @@ handle_recv(El, Pkt, #{server_host := ServerHost} = State) -> handle_send(El, Pkt, #{server_host := ServerHost} = State) -> ejabberd_hooks:run_fold(s2s_out_handle_send, ServerHost, State, [El, Pkt]). -handle_timeout(#{on_route := Action} = State) -> +handle_timeout(#{on_route := Action, lang := Lang} = State) -> case Action of bounce -> stop(State); - _ -> send(State, xmpp:serr_connection_timeout()) + _ -> + Txt = <<"Idle connection">>, + send(State, xmpp:serr_connection_timeout(Txt, Lang)) end. init([#{server := LServer, remote_server := RServer} = State, Opts]) -> diff --git a/src/xmpp_stream_in.erl b/src/xmpp_stream_in.erl index c27ac5f6b..6e07e9006 100644 --- a/src/xmpp_stream_in.erl +++ b/src/xmpp_stream_in.erl @@ -367,11 +367,12 @@ handle_info({'$gen_all_state_event', {xmlstreamcdata, Data}}, noreply(try Mod:handle_cdata(Data, State) catch _:undef -> State end); -handle_info(timeout, #{mod := Mod} = State) -> +handle_info(timeout, #{mod := Mod, lang := Lang} = State) -> Disconnected = is_disconnected(State), noreply(try Mod:handle_timeout(State) catch _:undef when not Disconnected -> - send_pkt(State, xmpp:serr_connection_timeout()); + Txt = <<"Idle connection">>, + send_pkt(State, xmpp:serr_connection_timeout(Txt, Lang)); _:undef -> stop(State) end); diff --git a/src/xmpp_stream_out.erl b/src/xmpp_stream_out.erl index 7e79bb80e..ce67d4231 100644 --- a/src/xmpp_stream_out.erl +++ b/src/xmpp_stream_out.erl @@ -376,11 +376,12 @@ handle_info({'$gen_event', {xmlstreamend, _}}, State) -> noreply(process_stream_end({stream, reset}, State)); handle_info({'$gen_event', closed}, State) -> noreply(process_stream_end({socket, closed}, State)); -handle_info(timeout, #{mod := Mod} = State) -> +handle_info(timeout, #{mod := Mod, lang := Lang} = State) -> Disconnected = is_disconnected(State), noreply(try Mod:handle_timeout(State) catch _:undef when not Disconnected -> - send_pkt(State, xmpp:serr_connection_timeout()); + Txt = <<"Idle connection">>, + send_pkt(State, xmpp:serr_connection_timeout(Txt, Lang)); _:undef -> stop(State) end);