anchor.diff:  %% @private
   -spec terminate(term(), state_t()) -> term().
   terminate(_Reason, #state{connections=Connections}=_State) ->
  -    dict:map(fun(_K, Pid) ->
  -                     try
  -                         gen_server:stop(Pid, normal, infinity)
  -                     catch
  -                         _:_ ->
  -                             ok
  -                     end
  +    dict:map(fun(_K, Pids) ->
  +                     lists:foreach(fun(Pid) ->
  +                                        try
  +                                            gen_server:stop(Pid, normal, infinity)
  +                                        catch
  +                                            _:_ ->
  +                                                ok
  +                                        end
  +                                   end, Pids)
                end, Connections),
       ok.
   
  
positive.code: %% @private
  %%
  %% Function should enforce the invariant that all cluster members are
  %% keys in the dict pointing to undefined if they are disconnected or a
  %% socket pid if they are connected.
  %%
  maybe_connect({Name, _, _} = Node, Connections0) ->
      Connections = case dict:find(Name, Connections0) of
          %% Found in dict, and disconnected.
          {ok, undefined} ->
              case connect(Node) of
                  {ok, Pid} ->
                      dict:store(Name, Pid, Connections0);
                  _ ->
                      dict:store(Name, undefined, Connections0)
              end;
          %% Found in dict and connected.
          {ok, _Pid} ->
              Connections0;
          %% Not present; disconnected.
          error ->
              case connect(Node) of
                  {ok, Pid} ->
                      dict:store(Name, Pid, Connections0);
                  _ ->
                      dict:store(Name, undefined, Connections0)
              end
      end,
      Connections.
  
negative.code: get_local_state() ->
      gen_server:call(?MODULE, get_local_state, infinity).
  
  %% @doc Trigger function on connection close for a given node.
  on_down(Name, Function) ->
      gen_server:call(?MODULE, {on_down, Name, Function}, infinity).
  
  