diff options
author | Siri Hansen <[email protected]> | 2012-11-14 11:00:17 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2012-11-14 11:25:48 +0100 |
commit | ad398a0dbcdb36323d359bff61fe7f2e39f0e455 (patch) | |
tree | e84379fcc3266fe65b8cbeffe4229fcb80e2968a /lib | |
parent | 2145697ca8263f7afe5824dcf2cf4539dab5fa59 (diff) | |
download | otp-ad398a0dbcdb36323d359bff61fe7f2e39f0e455.tar.gz otp-ad398a0dbcdb36323d359bff61fe7f2e39f0e455.tar.bz2 otp-ad398a0dbcdb36323d359bff61fe7f2e39f0e455.zip |
[common_test] Allow server to terminate netconf session before rpc-reply
OTP-10570
ct_netconfc:close_session sometimes returned {error,closed} because
the ssh connection was closed (from the server side) before the
rpc-reply was received by the client. This is normal and can not be
helped. It has been corrected so the return will be 'ok' in this case.
Other error situations will still give {error,Reason}.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common_test/src/ct_netconfc.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/common_test/src/ct_netconfc.erl b/lib/common_test/src/ct_netconfc.erl index 28480ed983..294b82bff6 100644 --- a/lib/common_test/src/ct_netconfc.erl +++ b/lib/common_test/src/ct_netconfc.erl @@ -1132,14 +1132,26 @@ call(Client, Msg, Timeout, WaitStop) -> case ct_gen_conn:call(Pid,Msg,Timeout) of {error,{process_down,Pid,noproc}} -> {error,no_such_client}; + {error,{process_down,Pid,normal}} when WaitStop -> + %% This will happen when server closes connection + %% before clien received rpc-reply on + %% close-session. + ok; {error,{process_down,Pid,normal}} -> {error,closed}; {error,{process_down,Pid,Reason}} -> {error,{closed,Reason}}; Other when WaitStop -> MRef = erlang:monitor(process,Pid), - receive {'DOWN',MRef,process,_,_} -> Other - after Timeout -> {error,{timeout,Other}} + receive + {'DOWN',MRef,process,Pid,Normal} when Normal==normal; + Normal==noproc -> + Other; + {'DOWN',MRef,process,Pid,Reason} -> + {error,{{closed,Reason},Other}} + after Timeout -> + erlang:demonitor(MRef, [flush]), + {error,{timeout,Other}} end; Other -> Other |