anchor.diff:  	   end,
       a_lookup(HostPortFamilies, State, Acc1, Err);
   a_lookup([{Host, Port, TLS, Family}|HostPortFamilies], State, Acc, Err) ->
  -    Timeout = get_dns_timeout(State),
       Retries = get_dns_retries(State),
  -    case a_lookup(Host, Port, TLS, Family, Timeout, Retries) of
  +    case a_lookup(Host, Port, TLS, Family, State, Retries) of
   	{error, Reason} ->
   	    a_lookup(HostPortFamilies, State, Acc, {error, Reason});
   	{ok, AddrPorts} ->
  
positive.code: 	    Err
      end.
  
  -spec srv_lookup(string(), timeout(), integer()) ->
  			{ok, inet:hostent()} | network_error().
  srv_lookup(_SRVName, _Timeout, Retries) when Retries < 1 ->
      {error, timeout};
  srv_lookup(SRVName, Timeout, Retries) ->
      case inet_res:getbyname(SRVName, srv, Timeout) of
  	{ok, HostEntry} ->
  	    {ok, HostEntry};
  	{error, timeout} ->
  	    srv_lookup(SRVName, Timeout, Retries - 1);
  	{error, _} = Err ->
  	    Err
      end.
  
negative.code: %%% Internal functions
  %%%===================================================================
  -spec noreply(state()) -> noreply().
  noreply(State) ->
      {noreply, State, get_timeout(State)}.
  
  -spec is_disconnected(state()) -> boolean().
  is_disconnected(#{stream_state := StreamState}) ->
  