aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-01-28 11:10:22 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-01-28 11:10:22 +0300
commit795efb2ee1f37adfd1613957c00722e7f3e778e5 (patch)
tree85bd8dce2d92c424452a61179cebd1a58dfa5a94
parentFind and fix typos using 'codespell' (diff)
Improve logging of idle s2s connections
-rw-r--r--src/ejabberd_s2s_out.erl6
-rw-r--r--src/xmpp_stream_in.erl5
-rw-r--r--src/xmpp_stream_out.erl5
3 files changed, 10 insertions, 6 deletions
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);