Deal with already_started crypto and ssl conditions.

This commit is contained in:
Essien Ita Essien 2008-12-21 00:00:32 +01:00
parent 441ef59ec2
commit af7d7dab30
1 changed files with 12 additions and 2 deletions

View File

@ -49,8 +49,18 @@ handshake(ConnectionState = #connection_state{serverhost = Host, cacertfile=nil,
end;
handshake(ConnectionState = #connection_state{serverhost = Host}) ->
crypto:start(),
ok = ssl:start(),
EnsureStarted = fun(App) ->
case application:start(App) of
ok ->
ok;
{error, {already_started, App}} ->
ok;
{error, Reason} ->
throw(Reason)
end
end,
lists:foreach(EnsureStarted, [crypto, ssl]),
case gen_tcp:connect(Host, 5673, ?RABBIT_TCP_OPTS) of
{ok, Sock} ->