File 4911-ssh-Primitives-for-changing-the-acceptor-deamon-opti.patch of Package erlang

From 9e9232c955b467e0961493306777ca8adaba7376 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Tue, 2 Aug 2022 13:53:22 +0200
Subject: [PATCH 1/5] ssh: Primitives for changing the acceptor deamon options

---
 lib/ssh/src/ssh_system_sup.erl | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/lib/ssh/src/ssh_system_sup.erl b/lib/ssh/src/ssh_system_sup.erl
index 712ca9a7fc..a494c97daa 100644
--- a/lib/ssh/src/ssh_system_sup.erl
+++ b/lib/ssh/src/ssh_system_sup.erl
@@ -39,7 +39,9 @@
 	 get_daemon_listen_address/1,
          addresses/1,
          addresses/2,
-         get_options/2
+         get_options/2,
+         get_acceptor_options/1,
+         replace_acceptor_options/2
         ]).
 
 %% Supervisor callback
@@ -151,6 +153,32 @@ addresses(Role,  #address{address=Address, port=Port, profile=Profile}) ->
                  Port == any    orelse A#address.port == Port,
                  Profile == any orelse A#address.profile == Profile].
 
+%%%----------------------------------------------------------------
+%% SysPid is the DaemonRef
+
+get_acceptor_options(SysPid) ->
+    case get_daemon_listen_address(SysPid) of
+        {ok,Address} ->
+            get_options(SysPid, Address);
+        {error,Error} ->
+            {error,Error}
+    end.
+
+replace_acceptor_options(SysPid, NewOpts) ->
+    case get_daemon_listen_address(SysPid) of
+        {ok,Address} ->
+            try stop_listener(SysPid)
+            of
+                ok ->
+                    restart_acceptor(SysPid, Address, NewOpts)
+            catch
+                error:_ ->
+                    restart_acceptor(SysPid, Address, NewOpts)
+            end;
+        {error,Error} ->
+            {error,Error}
+    end.
+
 %%%=========================================================================
 %%%  Supervisor callback
 %%%=========================================================================
-- 
2.35.3

openSUSE Build Service is sponsored by