Skip to content

Commit

Permalink
Fix is_connected/0 function
Browse files Browse the repository at this point in the history
  • Loading branch information
zinid committed Mar 22, 2016
1 parent 61e914a commit cb27a35
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ejabberd_riak.erl
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ start_link(Num, Server, Port, _StartInterval, Options) ->
is_connected() ->
lists:all(
fun({_Id, Pid, _Type, _Modules}) when is_pid(Pid) ->
case catch riakc_pb_socket:is_connected(get_random_pid()) of
case catch riakc_pb_socket:is_connected(get_riak_pid(Pid)) of
true -> true;
_ -> false
end
end;
(_) ->
false
end, supervisor:which_children(ejabberd_riak_sup)).

%% @private
Expand Down Expand Up @@ -521,6 +523,9 @@ make_invalid_object(Val) ->

get_random_pid() ->
PoolPid = ejabberd_riak_sup:get_random_pid(),
get_riak_pid(PoolPid).

get_riak_pid(PoolPid) ->
case catch gen_server:call(PoolPid, get_pid) of
{ok, Pid} ->
Pid;
Expand Down

0 comments on commit cb27a35

Please sign in to comment.