anchor.diff:      send_heartbeat_with_peers(ns_node_disco:nodes_wanted(), master, StateData1#state.peers),
       {next_state, master, StateData1};
   
  -handle_info(send_heartbeat, worker, StateData) ->
  -    misc:flush(send_heartbeat),
  -    %% Workers don't send heartbeats, but it's simpler to just ignore
  -    %% the timer than to turn it off.
  -    {next_state, worker, StateData};
  -
   handle_info({peers, Peers}, master, StateData) ->
       S = update_peers(StateData, Peers),
       case lists:member(node(), Peers) of
  
positive.code:         false ->
              ?log_info("Master has been demoted. Peers = ~p", [Peers]),
              NewState = shutdown_master_sup(S),
              {next_state, worker, NewState}
      end;
  
  handle_info({peers, Peers}, StateName, StateData) when
        StateName == candidate; StateName == worker ->
      S = update_peers(StateData, Peers),
      case Peers of
          [N] when N == node() ->
              ale:info(?USER_LOGGER, "I'm now the only node, so I'm the master.", []),
              {next_state, master, start_master(S)};
          _ ->
              case lists:member(node(), Peers) of
                  true ->
                      {next_state, candidate, S};
                  false ->
                      {next_state, worker, S}
              end
      end;
  
  handle_info(Info, StateName, StateData) ->
  
negative.code:                  [Event, State]),
      {next_state, master, State}.
  
  %%
  %% Internal functions
  %%
  