diff options
author | Hans Nilsson <[email protected]> | 2017-03-02 20:02:50 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-04-07 10:19:55 +0200 |
commit | ccef9f6e379a2cee828a9b914a49a4ebc831f936 (patch) | |
tree | 98fa6a64deeb0b075afea3e515eb7e5b389546d6 /lib/ssh/src/ssh_options.erl | |
parent | 7925b59450dd6f34b756da7b10dd10af95304d94 (diff) | |
download | otp-ccef9f6e379a2cee828a9b914a49a4ebc831f936.tar.gz otp-ccef9f6e379a2cee828a9b914a49a4ebc831f936.tar.bz2 otp-ccef9f6e379a2cee828a9b914a49a4ebc831f936.zip |
ssh: Make an internal option delete function
Diffstat (limited to 'lib/ssh/src/ssh_options.erl')
-rw-r--r-- | lib/ssh/src/ssh_options.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_options.erl b/lib/ssh/src/ssh_options.erl index 55f9c6bdc8..512aefa76d 100644 --- a/lib/ssh/src/ssh_options.erl +++ b/lib/ssh/src/ssh_options.erl @@ -28,6 +28,7 @@ -export([default/1, get_value/5, get_value/6, put_value/5, + delete_key/5, handle_options/2 ]). @@ -75,7 +76,6 @@ get_value(Class, Key, Opts, _CallerMod, _CallerLine) when is_map(Opts) -> user_options -> maps:get(Key, Opts) end; get_value(Class, Key, Opts, _CallerMod, _CallerLine) -> - io:format("*** Bad Opts GET OPT ~p ~p:~p Key=~p,~n Opts=~p~n",[Class,_CallerMod,_CallerLine,Key,Opts]), error({bad_options,Class, Key, Opts, _CallerMod, _CallerLine}). @@ -90,7 +90,6 @@ get_value(Class, Key, Opts, Def, CallerMod, CallerLine) when is_map(Opts) -> error:{badkey,Key} -> Def end; get_value(Class, Key, Opts, _Def, _CallerMod, _CallerLine) -> - io:format("*** Bad Opts GET OPT ~p ~p:~p Key=~p,~n Opts=~p~n",[Class,_CallerMod,_CallerLine,Key,Opts]), error({bad_options,Class, Key, Opts, _CallerMod, _CallerLine}). @@ -136,6 +135,19 @@ put_socket_value(A, SockOpts) when is_atom(A) -> %%%================================================================ %%% +%%% Delete an option +%%% + +-spec delete_key(option_class(), option_key(), options(), + atom(), non_neg_integer()) -> options(). + +delete_key(internal_options, Key, Opts, _CallerMod, _CallerLine) when is_map(Opts) -> + InternalOpts = maps:get(internal_options,Opts), + Opts#{internal_options := maps:remove(Key, InternalOpts)}. + + +%%%================================================================ +%%% %%% Initialize the options %%% |