aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_telnet_client.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2015-03-24 16:31:56 +0100
committerPeter Andersson <[email protected]>2015-03-24 16:31:56 +0100
commitc3dd39edccb73f8a72db23a6c27818816cd53860 (patch)
treee92e29b60d7e743064523318a6bccf08681f77d8 /lib/common_test/src/ct_telnet_client.erl
parent577ca3553539c55aa67057e45778c12e3c5e3e80 (diff)
downloadotp-c3dd39edccb73f8a72db23a6c27818816cd53860.tar.gz
otp-c3dd39edccb73f8a72db23a6c27818816cd53860.tar.bz2
otp-c3dd39edccb73f8a72db23a6c27818816cd53860.zip
Introduce polling feature in ct_telnet
Diffstat (limited to 'lib/common_test/src/ct_telnet_client.erl')
-rw-r--r--lib/common_test/src/ct_telnet_client.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/common_test/src/ct_telnet_client.erl b/lib/common_test/src/ct_telnet_client.erl
index 36d33522a3..0c448e5b35 100644
--- a/lib/common_test/src/ct_telnet_client.erl
+++ b/lib/common_test/src/ct_telnet_client.erl
@@ -32,7 +32,7 @@
-module(ct_telnet_client).
-%% -define(debug, true).
+%%-define(debug, true).
-export([open/2, open/3, open/4, open/5, close/1]).
-export([send_data/2, send_data/3, get_data/1]).
@@ -111,7 +111,6 @@ get_data(Pid) ->
{ok,Data}
end.
-
%%%-----------------------------------------------------------------
%%% Internal functions
init(Parent, Server, Port, Timeout, KeepAlive, ConnName) ->
@@ -146,7 +145,7 @@ loop(State, Sock, Acc) ->
ok
end;
{tcp,_,Msg0} ->
- dbg("tcp msg: ~tp~n",[Msg0]),
+ dbg("rcv tcp msg: ~tp~n",[Msg0]),
Msg = check_msg(Sock,Msg0,[]),
loop(State, Sock, [Msg | Acc]);
{send_data,Data} ->
@@ -180,6 +179,7 @@ loop(State, Sock, Acc) ->
NewState =
case State of
#state{keep_alive = true, get_data = 0} ->
+ dbg("sending NOP\n",[]),
if Acc == [] -> send([?IAC,?NOP], Sock,
State#state.conn_name);
true -> ok
@@ -225,15 +225,17 @@ loop(State, Sock, Acc) ->
gen_tcp:close(Sock),
Pid ! closed
after wait(State#state.keep_alive,?IDLE_TIMEOUT) ->
+ dbg("idle timeout\n",[]),
Data = lists:reverse(lists:append(Acc)),
case Data of
[] ->
+ dbg("sending NOP\n",[]),
send([?IAC,?NOP], Sock, State#state.conn_name),
loop(State, Sock, Acc);
_ when State#state.log_pos == length(Data)+1 ->
loop(State, Sock, Acc);
_ ->
- dbg("Idle timeout, printing ~tp\n",[Data]),
+ dbg("idle timeout, printing ~tp\n",[Data]),
Len = length(Data),
ct_telnet:log(State#state.conn_name,
general_io, "~ts",