25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix is_connected/0 function

This commit is contained in:
Evgeniy Khramtsov 2016-03-22 19:58:59 +03:00
parent 61e914a83f
commit cb27a3540e

View File

@ -75,10 +75,12 @@ start_link(Num, Server, Port, _StartInterval, Options) ->
is_connected() -> is_connected() ->
lists:all( lists:all(
fun({_Id, Pid, _Type, _Modules}) when is_pid(Pid) -> 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; true -> true;
_ -> false _ -> false
end end;
(_) ->
false
end, supervisor:which_children(ejabberd_riak_sup)). end, supervisor:which_children(ejabberd_riak_sup)).
%% @private %% @private
@ -521,6 +523,9 @@ make_invalid_object(Val) ->
get_random_pid() -> get_random_pid() ->
PoolPid = ejabberd_riak_sup: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 case catch gen_server:call(PoolPid, get_pid) of
{ok, Pid} -> {ok, Pid} ->
Pid; Pid;