anchor.diff:  %% remove_transport
   shutdown(Refs, #state{watchdogT = WatchdogT})
     when is_list(Refs) ->
  -    ets:foldl(fun(P,ok) -> st(P, Refs), ok end, ok, WatchdogT);
  +    ets:insert(WatchdogT, ets:foldl(fun(R,A) -> st(R, Refs, A) end,
  +                                    [],
  +                                    WatchdogT));
   
   %% application/service shutdown
   shutdown(Reason, #state{watchdogT = WatchdogT})
     when Reason == application;
          Reason == service ->
  -    diameter_lib:wait(ets:foldl(fun(P,A) -> st(P, Reason, A) end,
  +    diameter_lib:wait(ets:foldl(fun(P,A) -> ss(P, Reason, A) end,
                                   [],
                                   WatchdogT)).
   
  -%% st/2
  -
  -st(#watchdog{ref = Ref, pid = Pid}, Refs) ->
  -    lists:member(Ref, Refs)
  -        andalso (Pid ! {shutdown, self(), transport}).  %% 'DOWN' cleans up
  -
   %% st/3
   
  -st(#watchdog{pid = Pid}, Reason, Acc) ->
  +%% Mark replacement as started so that a subsequent accept doesn't
  +%% result in a new process that isn't terminated.
  +st(#watchdog{ref = Ref, pid = Pid, peer = P} = Rec, Refs, Acc) ->
  +    case lists:member(Ref, Refs) of
  +        true ->
  +            Pid ! {shutdown, self(), transport},  %% 'DOWN' cleans up
  +            [Rec#watchdog{peer = true} || P == false] ++ Acc;
  +        false ->
  +            Acc
  +    end.
  +
  +%% ss/3
  +
  +ss(#watchdog{pid = Pid}, Reason, Acc) ->
       MRef = monitor(process, Pid),
       Pid ! {shutdown, self(), Reason},
       [MRef | Acc].
  
positive.code:          state = ?WD_INITIAL :: match(wd_state()),
           started = diameter_lib:now(),%% at process start
           peer = false :: match(boolean() | pid())}).
                        %% true at accepted, pid() at okay/reopen
  
  %% Record representing a Peer State Machine processes implemented by
  %% diameter_peer_fsm.
  
negative.code: %% ---------------------------------------------------------------------------
  
  accepted(Pid, _TPid, #state{watchdogT = WatchdogT} = S) ->
      #watchdog{type = accept = T, peer = P}
          = Wd
          = fetch(WatchdogT, Pid),
      if not P ->
              #watchdog{ref = Ref, options = Opts} = Wd,
              %% Mark replacement started, and start new watchdog.
              ets:insert(WatchdogT, Wd#watchdog{peer = true}),
              start(Ref, T, Opts, S);
         P ->
              %% Transport removal in progress: true has been set in
              %% shutdown/2, and the transport will die as a
              %% consequence.
              ok
      end.
  
  %% fetch/2
  
  fetch(Tid, Key) ->
      [T] = ets:lookup(Tid, Key),
  