mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Fix is_connected/0 function
This commit is contained in:
parent
61e914a83f
commit
cb27a3540e
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user