anchor.diff:  init(State) ->
       {ok, State}.
   
  -%% Only set initial nodes if we haven't yet received an event
  -handle_call({init_nodes, Nodes}, State = #subscribe_all_state{noderefs=[]}) ->
  -    NodeRefs = [{Node, subscribe_node(Node, State)} || Node <- Nodes],
  -    {ok, ok, State#subscribe_all_state{noderefs=NodeRefs}};
  -handle_call({init_nodes, _}, State = #subscribe_all_state{noderefs=[_|_]}) ->
  -    {ok, ok, State}.
  +
  +handle_call(_Request, State) ->
  +    {reply, ok, State}.
   
   
   handle_event(Event, State = #state{func=Fun, func_state=FS}) ->
       NewState = Fun(Event, FS),
  -    {ok, State#state{func_state=NewState}};
  -handle_event({ns_node_disco_events, _OldNodes, Nodes},
  -             State = #subscribe_all_state{noderefs=NodeRefs}) ->
  -    NewNodeRefs = [{N, subscribe_node(N, State)} ||
  -                      N <- Nodes, not lists:keymember(N, 1, NodeRefs)],
  -    KeepNodeRefs = [NR || NR = {N, _} <- NodeRefs, not lists:member(N, Nodes)],
  -    {ok, State#subscribe_all_state{noderefs=NewNodeRefs ++ KeepNodeRefs}}.
  +    {ok, State#state{func_state=NewState}}.
   
   
   handle_info(_Msg, State) ->
       {ok, State}.
   
   
  -terminate(_Reason, #subscribe_all_state{noderefs=NodeRefs, name=Name}) ->
  -    lists:foreach(fun ({Node, Ref}) ->
  -                          unsubscribe({Name, Node}, Ref)
  -                  end, NodeRefs);
   terminate(_Reason, _State) ->
       ok.
   
  
positive.code:                                    #state{func=Fun, func_state=State}),
      Ref.
  
  
  %% Subscribe to the same event on all nodes
  subscribe_all(Name) ->
      subscribe_all(Name, msg_fun(self()), ignored).
  
  
  subscribe_all(Name, Fun, State) ->
      Ref = make_ref(),
      ok = gen_event:add_sup_handler(ns_node_disco_events, {?MODULE, Ref},
                                     #subscribe_all_state{noderefs=[], name=Name,
                                                          func=Fun,
                                                          func_state=State}),
      ok = gen_event:call(ns_node_disco_events, {?MODULE, Ref},
                          {init_nodes, ns_node_disco:nodes_actual_proper()}),
      Ref.
  
  
  unsubscribe(Name, Ref) ->
      gen_event:delete_handler(Name, {?MODULE, Ref}, unsubscribed).
  
  
  %% We don't need the name for this because it's in the state of the
  %% handler installed on ns_node_disco_events
  unsubscribe_all(Ref) ->
      gen_event:delete_handler(ns_node_disco_events, {?MODULE, Ref},
                               unsubscribed).
  
  
  %%
  %% gen_event callbacks
  
negative.code:             Pid ! Event,
              ignored
      end.
  