aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2016-02-23 18:04:37 +0100
committerIngela Anderton Andin <[email protected]>2016-02-23 18:04:37 +0100
commitdf597b37df56c78383601135bab16a46739d8c86 (patch)
treee5f68b2a5993d75d23445d694ca1accdf1aa86a0
parent7e798810cad67ce0cdc91ca57624ff2a6ea3431e (diff)
downloadotp-df597b37df56c78383601135bab16a46739d8c86.tar.gz
otp-df597b37df56c78383601135bab16a46739d8c86.tar.bz2
otp-df597b37df56c78383601135bab16a46739d8c86.zip
ssl: Modernize utility function
Use application:ensure_all_started/2 instead of hard coding dependencies
-rw-r--r--lib/ssl/src/ssl.erl23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl
index 6551308935..a9209015f6 100644
--- a/lib/ssl/src/ssl.erl
+++ b/lib/ssl/src/ssl.erl
@@ -60,22 +60,19 @@
-spec start() -> ok | {error, reason()}.
-spec start(permanent | transient | temporary) -> ok | {error, reason()}.
%%
-%% Description: Utility function that starts the ssl,
-%% crypto and public_key applications. Default type
-%% is temporary. see application(3)
+%% Description: Utility function that starts the ssl and applications
+%% that it depends on.
+%% see application(3)
%%--------------------------------------------------------------------
start() ->
- application:start(crypto),
- application:start(asn1),
- application:start(public_key),
- application:start(ssl).
-
+ start(temporary).
start(Type) ->
- application:start(crypto, Type),
- application:start(asn1),
- application:start(public_key, Type),
- application:start(ssl, Type).
-
+ case application:ensure_all_started(ssl, Type) of
+ {ok, _} ->
+ ok;
+ Other ->
+ Other
+ end.
%%--------------------------------------------------------------------
-spec stop() -> ok.
%%