Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
4912-ssh-Function-to-merge-new-options-into-an-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4912-ssh-Function-to-merge-new-options-into-an-existing-o.patch of Package erlang
From fe87250da6b7b37a4e1766e9bff3a923ad0b861c Mon Sep 17 00:00:00 2001 From: Hans Nilsson <hans@erlang.org> Date: Tue, 2 Aug 2022 15:05:30 +0200 Subject: [PATCH 2/5] ssh: Function to merge new options into an existing options map --- lib/ssh/src/ssh_options.erl | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/ssh/src/ssh_options.erl b/lib/ssh/src/ssh_options.erl index 4351782247..9e06ddb7de 100644 --- a/lib/ssh/src/ssh_options.erl +++ b/lib/ssh/src/ssh_options.erl @@ -34,7 +34,8 @@ keep_set_options/2, no_sensitive/2, initial_default_algorithms/2, - check_preferred_algorithms/1 + check_preferred_algorithms/1, + merge_options/3 ]). -export_type([private_options/0 @@ -151,6 +152,14 @@ delete_key(internal_options, Key, Opts, _CallerMod, _CallerLine) when is_map(Opt Opts#{internal_options := maps:remove(Key, InternalOpts)}. +%%%================================================================ +%%% +%%% Replace 0 or more options in an options map +%%% +merge_options(Role, NewPropList, Opts0) when is_list(NewPropList), + is_map(Opts0) -> + check_and_save(NewPropList, default(Role), Opts0). + %%%================================================================ %%% %%% Initialize the options @@ -219,10 +228,8 @@ handle_options(Role, OptsList0, Opts0) when is_map(Opts0), %% Enter the user's values into the map; unknown keys are %% treated as socket options - final_preferred_algorithms( - lists:foldl(fun(KV, Vals) -> - save(KV, OptionDefinitions, Vals) - end, InitialMap, OptsList2)) + check_and_save(OptsList2, OptionDefinitions, InitialMap) + catch error:{EO, KV, Reason} when EO == eoptions ; EO == eerl_env -> if @@ -235,6 +242,13 @@ handle_options(Role, OptsList0, Opts0) when is_map(Opts0), end end. +check_and_save(OptsList, OptionDefinitions, InitialMap) -> + final_preferred_algorithms( + lists:foldl(fun(KV, Vals) -> + save(KV, OptionDefinitions, Vals) + end, InitialMap, OptsList)). + + cnf_key(server) -> server_options; cnf_key(client) -> client_options. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor