aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2016-02-22 11:10:53 +0000
committerMagnus Henoch <[email protected]>2016-02-22 11:10:53 +0000
commit7e798810cad67ce0cdc91ca57624ff2a6ea3431e (patch)
treea4554220d312e1c2fc225ed74d87eedea9a00260
parentd0002b70b1f948dcef3e08781b9db589907776c5 (diff)
downloadotp-7e798810cad67ce0cdc91ca57624ff2a6ea3431e.tar.gz
otp-7e798810cad67ce0cdc91ca57624ff2a6ea3431e.tar.bz2
otp-7e798810cad67ce0cdc91ca57624ff2a6ea3431e.zip
Fix ssl example
As recently discussed on the erlang-questions mailing list, this example fails to start the ssl application because ssl depends on asn1 nowadays. Let's future-proof this by using application:ensure_all_started/1.
-rw-r--r--lib/ssl/examples/src/client_server.erl7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/ssl/examples/src/client_server.erl b/lib/ssl/examples/src/client_server.erl
index 799027123f..019b5130d2 100644
--- a/lib/ssl/examples/src/client_server.erl
+++ b/lib/ssl/examples/src/client_server.erl
@@ -26,9 +26,7 @@
start() ->
%% Start ssl application
- application:start(crypto),
- application:start(public_key),
- application:start(ssl),
+ {ok, StartedApps} = application:ensure_all_started(ssl),
%% Let the current process be the server that listens and accepts
%% Listen
@@ -52,7 +50,8 @@ start() ->
ssl:close(ASock),
io:fwrite("Listen: closing and terminating.~n"),
ssl:close(LSock),
- application:stop(ssl).
+
+ lists:foreach(fun application:stop/1, lists:reverse(StartedApps)).
%% Client connect