diff --git a/lib/inets/src/inets_app/inets.erl b/lib/inets/src/inets_app/inets.erl index 99f3ba233ca5..706915b21f5c 100644 --- a/lib/inets/src/inets_app/inets.erl +++ b/lib/inets/src/inets_app/inets.erl @@ -47,10 +47,12 @@ %% Description: Starts the inets application. Default type %% is temporary. see application(3) %%-------------------------------------------------------------------- -start() -> +start() -> + application:ensure_all_started(ssl), application:start(inets). -start(Type) -> +start(Type) -> + application:ensure_all_started(ssl), application:start(inets, Type). @@ -92,7 +94,7 @@ start(Service, ServiceConfig, How) -> %% %% Description: Stops the inets application. %%-------------------------------------------------------------------- -stop() -> +stop() -> application:stop(inets). @@ -104,12 +106,14 @@ stop() -> %% Description: Stops a started service of the inets application or takes %% down a stand alone "service" gracefully. %%-------------------------------------------------------------------- -stop(stand_alone, Pid) -> - true = exit(Pid, shutdown), - ok; - stop(Service, Pid) -> - call_service(Service, stop_service, Pid). + case Service of + stand_alone -> + true = exit(Pid, shutdown), + ok; + _ -> + call_service(Service, stop_service, Pid) + end. %%-------------------------------------------------------------------- @@ -119,16 +123,13 @@ stop(Service, Pid) -> %% Note: Services started with the stand alone option will not be listed %%-------------------------------------------------------------------- services() -> - try lists:flatten(lists:map(fun(Module) -> - Module:services() - end, service_names())) of - Result -> - Result - catch - exit:{noproc, _} -> + try + lists:flatmap(fun(Module) -> Module:services() end, service_names()) + catch + exit:{noproc, _} -> {error, inets_not_started} end. - + %%-------------------------------------------------------------------- %% Function: services_info() -> [{Service, Pid, Info}] @@ -138,20 +139,20 @@ services() -> %%-------------------------------------------------------------------- services_info() -> case services() of - {error, inets_not_started} -> - {error, inets_not_started}; - Services -> - Fun = fun({Service, Pid}) -> - Info = - case Service:service_info(Pid) of - {ok, PropList} -> - PropList; - {error, Reason} -> - Reason - end, - {Service, Pid, Info} - end, - lists:flatten(lists:map(Fun, Services)) + {error, inets_not_started} -> + {error, inets_not_started}; + Services -> + Fun = fun({Service, Pid}) -> + Info = + case Service:service_info(Pid) of + {ok, PropList} -> + PropList; + {error, Reason} -> + Reason + end, + {Service, Pid, Info} + end, + lists:flatmap(Fun, Services) end. @@ -434,10 +435,12 @@ report_event(Severity, Label, Service, Content) -> %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -start_service(Service, Args, stand_alone) -> - Service:start_standalone(Args); -start_service(Service, Args, inets) -> - call_service(Service, start_service, Args). +start_service(Service, Args, How) -> + application:ensure_all_started(ssl), + case How of + stand_alone -> Service:start_standalone(Args); + inets -> call_service(Service, start_service, Args) + end. call_service(Service, Call, Args) -> try Service:Call(Args) of