If an altdomain was specified, use it instead of SRV lookups.

For whatever reason, SRV lookups are hanging for me for about 30
seconds making testing suck.
This commit is contained in:
Dustin Sallings
2009-04-08 15:41:45 -07:00
parent 3156f5044f
commit e852bfb62e

View File

@@ -383,14 +383,19 @@ int xmpp_connect_client(xmpp_conn_t * const conn,
conn->domain = xmpp_jid_domain(conn->ctx, conn->jid);
if (!conn->domain) return -1;
if (!sock_srv_lookup("xmpp-client", "tcp", conn->domain, connectdomain, 2048, &connectport))
{
if (altdomain) {
xmpp_debug(conn->ctx, "xmpp", "Connecting via altdomain.");
strcpy(connectdomain, altdomain);
connectport = altport ? altport : 5222;
} else if (!sock_srv_lookup("xmpp-client", "tcp", conn->domain,
connectdomain, 2048, &connectport)) {
xmpp_debug(conn->ctx, "xmpp", "SRV lookup failed.");
if (!altdomain)
domain = conn->domain;
else
domain = altdomain;
xmpp_debug(conn->ctx, "xmpp", "Using alternate domain %s, port %d", altdomain, altport);
xmpp_debug(conn->ctx, "xmpp", "Using alternate domain %s, port %d",
altdomain, altport);
strcpy(connectdomain, domain);
connectport = altport ? altport : 5222;
}