anchor.diff:           State = #state{client = Client})
     when Tries > 0 ->
       Req = request_to_iolist(Frame, State),
  +    ReqStart = os:timestamp(),
       try cowboy_client:raw_request(Req, Client) of
           {ok, Client2} ->
  -            wait_response(Frame, State#state{client=Client2});
  +            wait_response(Frame, ReqStart, State#state{client=Client2});
           {error, Why} ->
               ?WARN("drain_id=~p channel_id=~p dest=~s at=send_request"
                     " tcp_err=~1000p",
  
positive.code: status_action(N) when 400 =< N, N < 500 -> perm_fail;
  status_action(_) -> temp_fail.
  
  wait_response(Frame = #frame{},
                State = #state{client = Client}) ->
      try cowboy_client:response(Client) of
          {ok, Status, _Headers, Client2} ->
              Result = status_action(Status),
              ?INFO("drain_id=~p channel_id=~p dest=~s at=response "
                    "result=~p status=~p msg_count=~p",
                    log_info(State, [Result, Status, Frame#frame.msg_count])),
              case Result of
                  success ->
                      ready_to_send(sent_frame(Frame,
  
negative.code:     State#state{reconnect_tref=undefined};
  cancel_reconnect(State = #state{reconnect_tref=undefined}) ->
      State.
  
  ltcy(Start, End) ->
      timer:now_diff(End, Start).
  