diff --git a/gajim/common/connection.py b/gajim/common/connection.py
index 9db930192ad0c9cbf7296642c8fb75b152557c63..7367e10afb9f9f8d15a9873a44225bec0efa2b56 100644
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -928,10 +928,6 @@ class Connection(CommonConnection, ConnectionHandlers):
         ]
         self._hostname = hostname
 
-        if h:
-            app.resolver.resolve('_xmppconnect.' + helpers.idn_to_ascii(h),
-                                 self._on_resolve_txt, type_='txt')
-
         if use_srv and self._proxy is None:
             self._srv_hosts = []
 
@@ -941,6 +937,9 @@ class Connection(CommonConnection, ConnectionHandlers):
             for service in services:
                 record_name = '_' + service + '._tcp.' + helpers.idn_to_ascii(h)
                 app.resolver.resolve(record_name, self._on_resolve_srv)
+
+            app.resolver.resolve('_xmppconnect.' + helpers.idn_to_ascii(h),
+                                 self._on_resolve_txt, type_='txt')
         else:
             self._connect_to_next_host()