Skip to content

Commit

Permalink
Export ensure_started and use it in the socket server.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Reid committed Apr 9, 2011
1 parent 5199163 commit a110325
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/mochiweb.erl
Expand Up @@ -9,6 +9,7 @@
-export([start/0, stop/0]).
-export([new_request/1, new_response/1]).
-export([all_loaded/0, all_loaded/1, reload/0]).
-export([ensure_started/1]).

%% @spec start() -> ok
%% @doc Start the MochiWeb server.
Expand Down Expand Up @@ -77,8 +78,9 @@ new_response({Request, Code, Headers}) ->
Code,
mochiweb_headers:make(Headers)).

%% Internal API

%% @spec ensure_started(App::atom()) -> ok
%% @doc Start the given App if it has not been started already.
ensure_started(App) ->
case application:start(App) of
ok ->
Expand Down
6 changes: 3 additions & 3 deletions src/mochiweb_socket_server.erl
Expand Up @@ -119,9 +119,9 @@ parse_options([{profile_fun, ProfileFun} | Rest], State) when is_function(Profil
start_server(State=#mochiweb_socket_server{ssl=Ssl, name=Name}) ->
_ = case Ssl of
true ->
ok = application:start(crypto),
ok = application:start(public_key),
ok = application:start(ssl);
ok = mochiweb:ensure_started(crypto),
ok = mochiweb:ensure_started(public_key),
ok = mochiweb:ensure_started(ssl);
false ->
void
end,
Expand Down

0 comments on commit a110325

Please sign in to comment.