anchor.diff:              end
       end.
   
  -first_port([Link|_Links]) when is_port(Link) -> Link;
  +first_port([Port|_Links]) when is_port(Port) -> Port;
   first_port([_|Links]) -> first_port(Links);
   first_port([]) -> undefined.
   
  
positive.code: check_repl(Node) ->
      case is_leader(Node) of
          true ->
              Clients = check_repl(Node, riak_repl_client_sup),
              Servers = check_repl(Node, riak_repl_server_sup),
              Clients ++ Servers;
          false ->
              []
      end.
  
  check_repl(Node, Sup) ->
      Pids = repl_pids(Node, Sup),
      [check_repl_pid(Node, Pid) || Pid <- Pids].
  
  repl_pids(Node, Sup) ->
      Nodes = riak_nodes(Node),
      {ResL, _} = rpc:multicall(Nodes, supervisor, which_children, [Sup]),
      Children = lists:flatten([Res || Res <- ResL, filter_badrpc(Res)]),
      [Pid || {_,Pid,_,_} <- Children, Pid /= undefined].
  
  check_repl_pid(Node, Pid) ->
      case rpc:call(Node, erlang, process_info, [Pid]) of
          undefined ->
              unknown;
          Info ->
              Links = proplists:get_value(links, Info),
              Port = first_port(Links),
              case Port of
                  undefined ->
  
negative.code: is_leader(Node) ->
      rpc:call(Node, riak_repl_leader, leader_node, []) == Node.
  
  unknown() ->
      {unknown, "Unexpected return from process_info", []}.
  
  