anchor.diff:               Opts,
                Caller,
                SvcName) ->
  -    #diameter_app{module = ModX}
  -        = App,
  -
       Pkt = make_prepare_packet(Mask, Msg),
   
  -    send_req(cb(ModX, prepare_request, [Pkt, SvcName, {TPid, Caps}]),
  +    send_req(cb(App, prepare_request, [Pkt, SvcName, {TPid, Caps}]),
                Pkt,
                Transport,
                Opts,
  
positive.code:     ?ERROR({invalid_return, prepare_retransmit, App, T}).
  
  resend_request(Pkt0,
                 {TPid, Caps, _},
                 #request{dictionary = Dict}
                 = Req0,
                 SvcName,
                 Tmo,
                 Fs) ->
  
negative.code:         {timeout = Reason, TRef, _} ->        %% No timely reply
              {error, Req, Reason};
          {failover, TRef} ->       %% Service says peer has gone down
              retransmit(Req, App, Opts, find_state(SvcName), Timeout)
      end.
  
  %% Note that failover starts a new timer and that expiry of an old
  %% timer value is ignored. This means that an answer could be accepted
  %% from a peer after timeout in the case of failover.
  
  retransmit(Req, App, Opts, #state{service_name = SvcName} = S, Timeout) ->
      rt(find_transport(Req, App, Opts, S), Req, Opts, SvcName, Timeout);
              
  retransmit(Req, _, _, false, _) ->  %% service has gone down
      {error, Req, failover}.
  
  rt({_,_,App} = Transport, Req, Opts, SvcName, Timeout) ->
      try retransmit(Transport, Req, SvcName, Timeout) of
          T -> recv_answer(Timeout, SvcName, App, Opts, T)
      catch
          ?FAILURE(Reason) -> {error, Req, Reason}
      end;
  
  rt(_, Req, _, _, _) ->  %% no alternate peer
      {error, Req, failover}.
  
  %% handle_error/4
  
  handle_error(App,
               #request{packet = Pkt,
                        transport = TPid,
                        caps = Caps},
               Reason,
               SvcName) ->
      cb(App, handle_error, [Reason, msg(Pkt), SvcName, {TPid, Caps}]).
  
  msg(#diameter_packet{msg = undefined, bin = Bin}) ->
      Bin;
  