diff options
author | Hans Nilsson <[email protected]> | 2018-03-29 12:00:38 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-03-29 12:00:38 +0200 |
commit | f2fc2178ffad5fb890b4cc8ae0d44e3096c98103 (patch) | |
tree | c7d17aa5d23d0d9a0efe45435d1b7581f222a20d /lib/ssh/src/ssh_acceptor.erl | |
parent | c7ae37130690648f2934e033c4d8ab9551d61ac9 (diff) | |
parent | a785db13533e1fba0f8459b3a5e5ea96ba0299c1 (diff) | |
download | otp-f2fc2178ffad5fb890b4cc8ae0d44e3096c98103.tar.gz otp-f2fc2178ffad5fb890b4cc8ae0d44e3096c98103.tar.bz2 otp-f2fc2178ffad5fb890b4cc8ae0d44e3096c98103.zip |
Merge branch 'hans/ssh/dbg/OTP-14896'
* hans/ssh/dbg/OTP-14896:
ssh: New test suite ssh_dbg_SUITE for testing ssh_dbg
ssh: Use the new ssh_dbg module
ssh: New ssh_dbg module
ssh: Add ssh_connection_handler:alg/1 for test purposes
ssh: Unused fields #ssh.hkey and #ssh.kex removed
ssh: Simplify ssh_connection and ssh_connection_handler and their internal interfaces
Diffstat (limited to 'lib/ssh/src/ssh_acceptor.erl')
-rw-r--r-- | lib/ssh/src/ssh_acceptor.erl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/ssh/src/ssh_acceptor.erl b/lib/ssh/src/ssh_acceptor.erl index 27d4242dd4..516a9febaa 100644 --- a/lib/ssh/src/ssh_acceptor.erl +++ b/lib/ssh/src/ssh_acceptor.erl @@ -33,6 +33,8 @@ %% spawn export -export([acceptor_init/5, acceptor_loop/6]). +-export([dbg_trace/3]). + -define(SLEEP_TIME, 200). %%==================================================================== @@ -195,3 +197,33 @@ handle_error(Reason) -> error_logger:error_report(String), exit({accept_failed, String}). +%%%################################################################ +%%%# +%%%# Tracing +%%%# + +dbg_trace(points, _, _) -> [connections]; + +dbg_trace(flags, connections, _) -> [c]; +dbg_trace(on, connections, _) -> dbg:tp(?MODULE, acceptor_init, 5, x), + dbg:tpl(?MODULE, handle_connection, 5, x); +dbg_trace(off, connections, _) -> dbg:ctp(?MODULE, acceptor_init, 5), + dbg:ctp(?MODULE, handle_connection, 5); +dbg_trace(format, connections, {call, {?MODULE,acceptor_init, + [_Parent, Port, Address, _Opts, _AcceptTimeout]}}) -> + [io_lib:format("Starting LISTENER on ~s:~p\n", [ntoa(Address),Port]) + ]; +dbg_trace(format, connections, {return_from, {?MODULE,handle_connection,5}, {error,Error}}) -> + ["Starting connection to server failed:\n", + io_lib:format("Error = ~p", [Error]) + ]. + + + +ntoa(A) -> + try inet:ntoa(A) + catch + _:_ when is_list(A) -> A; + _:_ -> io_lib:format('~p',[A]) + end. + |