Skip to content

Commit

Permalink
inets: Do not use internal or shell convenience functions in application
Browse files Browse the repository at this point in the history
ssl:start/[1,2] is a shell convenience function and should not be called
by other applications.

inet_db:start is an internal function that we should not have to call.
This was done for legacy reasons and is no longer needed.
  • Loading branch information
IngelaAndin committed Nov 11, 2015
1 parent 51a236b commit ef9d44b
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions lib/inets/src/http_lib/http_transport.erl
Expand Up @@ -49,39 +49,27 @@
%% start(SocketType) -> ok | {error, Reason}
%% SocketType = ip_comm | {ssl, _}
%%
%% Description: Makes sure inet_db or ssl is started.
%% Description: Makes sure ssl is started.
%%-------------------------------------------------------------------------
start(ip_comm) ->
do_start_ip_comm();
ok;
start({ip_comm, _}) ->
do_start_ip_comm();
%% This is just for backward compatibillity
ok;
start({ssl, _}) ->
do_start_ssl();
start({essl, _}) ->
do_start_ssl().


do_start_ip_comm() ->
case inet_db:start() of
{ok, _} ->
ok;
{error, {already_started, _}} ->
ok;
Error ->
Error
end.

do_start_ssl() ->
case ssl:start() of
ok ->
ok;
{error, {already_started,_}} ->
ok;
Error ->
Error
try lists:foreach(fun(App) ->
ok = application:ensure_started(App)
end,
[crypto, asn1, public_key, ssl])
catch
_:Reason ->
{error, Reason}
end.


%%-------------------------------------------------------------------------
%% connect(SocketType, Address, Options, Timeout) ->
Expand Down

0 comments on commit ef9d44b

Please sign in to comment.