aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-05-04 10:20:30 +0200
committerSiri Hansen <[email protected]>2016-05-04 10:20:30 +0200
commitfe324afcc0d2e114c680b5cd28c170e98f839720 (patch)
treed781cea3cda0ab9387c81e608505f10362f7d4e2
parent26e05452a32bae7910f16b163a92dc17e502228c (diff)
downloadotp-fe324afcc0d2e114c680b5cd28c170e98f839720.tar.gz
otp-fe324afcc0d2e114c680b5cd28c170e98f839720.tar.bz2
otp-fe324afcc0d2e114c680b5cd28c170e98f839720.zip
Change ct:sleep to timer:sleep in telnet_server
The telnet_server is run on the main test node which will scale and multiply timers on some test hosts. The other side of the telnet test (the client) is run on the slave, which does not inherit timer scaling and multiplication. Therefore, it is better to use timer:sleep in the server.
-rw-r--r--lib/common_test/test/telnet_server.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/common_test/test/telnet_server.erl b/lib/common_test/test/telnet_server.erl
index 107d98d72c..d3cffd88ff 100644
--- a/lib/common_test/test/telnet_server.erl
+++ b/lib/common_test/test/telnet_server.erl
@@ -59,7 +59,7 @@ init(Opts) ->
accept(State),
ok = gen_tcp:close(LSock),
dbg("telnet_server closed the listen socket ~p\n", [LSock]),
- ct:sleep(1000),
+ timer:sleep(1000),
ok.
listen(0, _Port, _Opts) ->
@@ -68,7 +68,7 @@ listen(Retries, Port, Opts) ->
case gen_tcp:listen(Port, Opts) of
{error,eaddrinuse} ->
dbg("Listen port not released, trying again..."),
- ct:sleep(5000),
+ timer:sleep(5000),
listen(Retries-1, Port, Opts);
Ok = {ok,_LSock} ->
Ok;
@@ -220,7 +220,7 @@ do_handle_data("echo_sep " ++ Data,State) ->
Msgs = string:tokens(Data," "),
lists:foreach(fun(Msg) ->
send(Msg,State),
- ct:sleep(10)
+ timer:sleep(10)
end, Msgs),
send("\r\n> ",State),
{ok,State};
@@ -245,7 +245,7 @@ do_handle_data("echo_loop " ++ Data,State) ->
do_handle_data("echo_delayed_prompt "++Data,State) ->
[MsStr|EchoData] = string:tokens(Data, " "),
send(string:join(EchoData,"\n"),State),
- ct:sleep(list_to_integer(MsStr)),
+ timer:sleep(list_to_integer(MsStr)),
send("\r\n> ",State),
{ok,State};
do_handle_data("disconnect_after " ++WaitStr,State) ->
@@ -298,7 +298,7 @@ send_loop(T0,T,Data,State) ->
ok;
true ->
send(Data,State),
- ct:sleep(500),
+ timer:sleep(500),
send_loop(T0,T,Data,State)
end.