anchor.diff:  	    end
       end.
   
  --spec srv_lookup(string(), state(), timeout(), integer()) ->
  -			{ok, h_addr_list()} | network_error().
  -srv_lookup(Host, #{xmlns := NS} = State, Timeout, Retries) ->
  +-spec do_srv_lookup(string(), state()) ->
  +			   {ok, h_addr_list()} | network_error().
  +do_srv_lookup(Host, #{xmlns := NS} = State) ->
  +    Retries = get_dns_retries(State),
       SRVType = case NS of
   		  ?NS_SERVER -> "-server._tcp.";
   		  ?NS_CLIENT -> "-client._tcp."
   	      end,
       TLSAddrs = case is_starttls_available(State) of
   		   true ->
  -		       case srv_lookup("_xmpps" ++ SRVType ++ Host,
  -				       Timeout, Retries) of
  +		       case do_srv_lookup("_xmpps" ++ SRVType ++ Host,
  +					  State, Retries) of
   			   {ok, HostEnt} ->
   			       [{A, true} || A <- HostEnt#hostent.h_addr_list];
   			   {error, _} ->
  
positive.code: 		   false ->
  		       []
  	       end,
      case srv_lookup("_xmpp" ++ SRVType ++ Host, Timeout, Retries) of
  	{ok, HostEntry} ->
  	    Addrs = [{A, false} || A <- HostEntry#hostent.h_addr_list],
  	    {ok, TLSAddrs ++ Addrs};
  
negative.code: 
  -spec get_connect_timeout(state()) -> timeout().
  get_connect_timeout(State) ->
      Timeout = try callback(connect_timeout, State)
  	      catch _:{?MODULE, undef} -> ?CONNECT_TIMEOUT
  	      end,
      min(Timeout, get_timeout(State)).
  
  %%%===================================================================
  %%% Callbacks
  