diff options
author | Peter Andersson <[email protected]> | 2013-06-04 16:10:09 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2013-06-04 16:13:40 +0200 |
commit | cf68fec61294194b47063d2368ff916964e8644d (patch) | |
tree | 9501c9abe4a2fa3715ff58210815356f829ac390 /lib/common_test/src/ct_telnet.erl | |
parent | f7f24a77e918eea712b435a5ae9b01de270d6d7d (diff) | |
parent | a1cc5adde3b289282dd5bfc7592a044d988c75a9 (diff) | |
download | otp-cf68fec61294194b47063d2368ff916964e8644d.tar.gz otp-cf68fec61294194b47063d2368ff916964e8644d.tar.bz2 otp-cf68fec61294194b47063d2368ff916964e8644d.zip |
Merge remote branch 'origin/peppe/common_test/ct_conn_handling' into maint
* origin/peppe/common_test/ct_conn_handling:
Add test suite
Fix faulty connection handling
OTP-10126
Diffstat (limited to 'lib/common_test/src/ct_telnet.erl')
-rw-r--r-- | lib/common_test/src/ct_telnet.erl | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/common_test/src/ct_telnet.erl b/lib/common_test/src/ct_telnet.erl index 4755d939e0..4092d33bc0 100644 --- a/lib/common_test/src/ct_telnet.erl +++ b/lib/common_test/src/ct_telnet.erl @@ -183,7 +183,8 @@ open(KeyOrName,ConnType,TargetMod,Extra) -> end; Bool -> Bool end, - log(heading(open,{KeyOrName,ConnType}),"Opening connection to: ~p",[Addr1]), + log(heading(open,{KeyOrName,ConnType}), + "Opening connection to: ~p",[Addr1]), ct_gen_conn:start(KeyOrName,full_addr(Addr1,ConnType), {TargetMod,KeepAlive,Extra},?MODULE) end. @@ -591,9 +592,9 @@ terminate(TelnPid,State) -> get_handle(Pid) when is_pid(Pid) -> {ok,Pid}; get_handle({Name,Type}) when Type==telnet;Type==ts1;Type==ts2 -> - case ct_util:get_connections(Name,?MODULE) of - {ok,Conns} when Conns /= [] -> - case get_handle(Type,Conns) of + case ct_util:get_connection(Name,?MODULE) of + {ok,Conn} -> + case get_handle(Type,Conn) of {ok,Pid} -> {ok,Pid}; _Error -> @@ -608,19 +609,15 @@ get_handle({Name,Type}) when Type==telnet;Type==ts1;Type==ts2 -> Error end end; - {ok,[]} -> - {error,already_closed}; Error -> Error end; get_handle(Name) -> get_handle({Name,telnet}). -get_handle(Type,[{Pid,{_,_,Type}}|_]) -> +get_handle(Type,{Pid,{_,_,Type}}) -> {ok,Pid}; -get_handle(Type,[_H|T]) -> - get_handle(Type,T); -get_handle(Type,[]) -> +get_handle(Type,_) -> {error,{no_such_connection,Type}}. full_addr({Ip,Port},Type) -> |