diff options
author | Hans Nilsson <hans@erlang.org> | 2022-01-12 07:59:33 +0100 |
---|---|---|
committer | Hans Nilsson <hans@erlang.org> | 2022-02-24 11:27:38 +0100 |
commit | fbede23497873f214c9a573ae5257b5aee4d6dc3 (patch) | |
tree | 278e954f75e046edd1cdb86ff2b10fe019e908ed | |
parent | 9473578309f64069fc909451f410d605170639a8 (diff) | |
download | erlang-fbede23497873f214c9a573ae5257b5aee4d6dc3.tar.gz |
ssh: Extend ssh_dbg with 'handshake'
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index fd647213dc..2bee158f26 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -86,7 +86,9 @@ ]). -behaviour(ssh_dbg). --export([ssh_dbg_trace_points/0, ssh_dbg_flags/1, ssh_dbg_on/1, ssh_dbg_off/1, ssh_dbg_format/2]). +-export([ssh_dbg_trace_points/0, ssh_dbg_flags/1, + ssh_dbg_on/1, ssh_dbg_off/1, + ssh_dbg_format/2, ssh_dbg_format/3]). -define(call_disconnectfun_and_log_cond(LogMsg, DetailedText, StateName, D), @@ -2021,11 +2023,12 @@ update_inet_buffers(Socket) -> %%%# ssh_dbg_trace_points() -> [terminate, disconnect, connections, connection_events, renegotiation, - tcp]. + tcp, connection_handshake]. ssh_dbg_flags(connections) -> [c | ssh_dbg_flags(terminate)]; ssh_dbg_flags(renegotiation) -> [c]; ssh_dbg_flags(connection_events) -> [c]; +ssh_dbg_flags(connection_handshake) -> [c]; ssh_dbg_flags(terminate) -> [c]; ssh_dbg_flags(tcp) -> [c]; ssh_dbg_flags(disconnect) -> [c]. @@ -2033,6 +2036,7 @@ ssh_dbg_flags(disconnect) -> [c]. ssh_dbg_on(connections) -> dbg:tp(?MODULE, init, 1, x), ssh_dbg_on(terminate); ssh_dbg_on(connection_events) -> dbg:tp(?MODULE, handle_event, 4, x); +ssh_dbg_on(connection_handshake) -> dbg:tpl(?MODULE, handshake, 3, x); ssh_dbg_on(renegotiation) -> dbg:tpl(?MODULE, init_renegotiate_timers, 3, x), dbg:tpl(?MODULE, pause_renegotiate_timers, 3, x), dbg:tpl(?MODULE, check_data_rekeying_dbg, 2, x), @@ -2061,6 +2065,7 @@ ssh_dbg_off(renegotiation) -> dbg:ctpl(?MODULE, init_renegotiate_timers, 3), dbg:ctpl(?MODULE, start_rekeying, 2), dbg:ctpg(?MODULE, renegotiate, 1); ssh_dbg_off(connection_events) -> dbg:ctpg(?MODULE, handle_event, 4); +ssh_dbg_off(connection_handshake) -> dbg:ctpl(?MODULE, handshake, 3); ssh_dbg_off(connections) -> dbg:ctpg(?MODULE, init, 1), ssh_dbg_off(terminate). @@ -2226,3 +2231,18 @@ ssh_dbg_format(disconnect, {call,{?MODULE,send_disconnect, ssh_dbg_format(renegotiation, {return_from, {?MODULE,send_disconnect,7}, _Ret}) -> skip. + +ssh_dbg_format(connection_handshake, {call, {?MODULE,handshake,[Pid, Ref, Timeout]}}, Stack) -> + {["Connection handshake\n", + io_lib:format("Connection Child: ~p~nReg: ~p~nTimeout: ~p~n", + [Pid, Ref, Timeout]) + ], + [Pid|Stack] + }; +ssh_dbg_format(connection_handshake, {Tag, {?MODULE,handshake,3}, Ret}, [Pid|Stack]) -> + {[lists:flatten(io_lib:format("Connection handshake result ~p\n", [Tag])), + io_lib:format("Connection Child: ~p~nRet: ~p~n", + [Pid, Ret]) + ], + Stack + }. |