aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_gen_conn.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2012-08-23 16:57:47 +0200
committerPeter Andersson <[email protected]>2012-08-23 16:57:47 +0200
commitada34eeaa3e7f034a3c69ccc95e1bcf2226cb7eb (patch)
tree69964df4ca0c14d849391188c4b7e3efc81fde66 /lib/common_test/src/ct_gen_conn.erl
parentc8969d42acbdff2c65f48a27dcd1cb36b15d4b87 (diff)
parente13b9c155d266946be86e52ba9344f43ca8640cc (diff)
downloadotp-ada34eeaa3e7f034a3c69ccc95e1bcf2226cb7eb.tar.gz
otp-ada34eeaa3e7f034a3c69ccc95e1bcf2226cb7eb.tar.bz2
otp-ada34eeaa3e7f034a3c69ccc95e1bcf2226cb7eb.zip
Merge remote branch 'origin/peppe/common_test/silent_connection' into maint
* origin/peppe/common_test/silent_connection: Fix deadlock problem in connection handling Implement silent_connection for ssh Conflicts: lib/common_test/src/ct_gen_conn.erl OTP-9625
Diffstat (limited to 'lib/common_test/src/ct_gen_conn.erl')
-rw-r--r--lib/common_test/src/ct_gen_conn.erl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/common_test/src/ct_gen_conn.erl b/lib/common_test/src/ct_gen_conn.erl
index 5df9127725..1f01d84601 100644
--- a/lib/common_test/src/ct_gen_conn.erl
+++ b/lib/common_test/src/ct_gen_conn.erl
@@ -121,7 +121,7 @@ start(Name,Address,InitData,CallbackMod) ->
%%%
%%% @doc Close the connection and stop the process managing it.
stop(Pid) ->
- call(Pid,stop).
+ call(Pid,stop,5000).
%%%-----------------------------------------------------------------
%%% @spec log(Heading,Format,Args) -> ok
@@ -251,9 +251,10 @@ check_opts([{old,Bool}|T],Opts) ->
check_opts([],Opts) ->
Opts.
-call(Pid,Msg) ->
- call(Pid,Msg,infinity).
-call(Pid,Msg,Timeout) ->
+call(Pid, Msg) ->
+ call(Pid, Msg, infinity).
+
+call(Pid, Msg, Timeout) ->
MRef = erlang:monitor(process,Pid),
Ref = make_ref(),
Pid ! {Msg,{self(),Ref}},
@@ -270,7 +271,11 @@ call(Pid,Msg,Timeout) ->
{error,{process_down,Pid,Reason}}
after Timeout ->
erlang:demonitor(MRef, [flush]),
- exit(timeout)
+ log("ct_gen_conn",
+ "Connection process ~p not responding. Killing now!",
+ [Pid]),
+ exit(Pid, kill),
+ {error,{process_down,Pid,forced_termination}}
end.
return({To,Ref},Result) ->