anchor.diff:  		   false ->
   		       []
   	       end,
  -    case srv_lookup("_xmpp" ++ SRVType ++ Host, Timeout, Retries) of
  +    case do_srv_lookup("_xmpp" ++ SRVType ++ Host, State, Retries) of
   	{ok, HostEntry} ->
   	    Addrs = [{A, false} || A <- HostEntry#hostent.h_addr_list],
   	    {ok, TLSAddrs ++ Addrs};
  
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:     {ok, Acc}.
  
  -spec a_lookup(inet:hostname(), inet:port_number(), boolean(), inet:address_family(),
  	       state(), integer()) -> {ok, [ip_port()]} | network_error().
  a_lookup(_Host, _Port, _TLS, _Family, _State, Retries) when Retries < 1 ->
      {error, timeout};
  a_lookup(Host, Port, TLS, Family, State, Retries) ->
      Timeout = get_dns_timeout(State),
      Start = current_time(),
      case inet:gethostbyname(Host, Family, Timeout) of
  	{error, nxdomain} = Err ->
  	    %% inet:gethostbyname/3 doesn't return {error, timeout},
  	    %% so we should check if 'nxdomain' is in fact a result
  	    %% of a timeout.
  	    %% We also cannot use inet_res:gethostbyname/3 because
  	    %% it ignores DNS configuration settings (e.g. /etc/hosts)
  	    End = current_time(),
  	    if (End - Start) >= Timeout ->
  		    a_lookup(Host, Port, TLS, Family, State, Retries - 1);
  	       true ->
  		    Err
  	    end;
  