Ignore:
Timestamp:
2010-08-10T11:18:09Z (10 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
72176c1
Parents:
f32c14c
Message:

When doing SRV lookups, return an array with all RRs instead of just the
first one. The first isn't always the best one and this is currently causing
GTalk issues when talk2.l.google.com (which is currently dead) is first.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    rf32c14c rffdf2e7  
    9696        struct im_connection *ic = imcb_new( acc );
    9797        struct jabber_data *jd = g_new0( struct jabber_data, 1 );
    98         struct ns_srv_reply *srv = NULL;
     98        struct ns_srv_reply **srvl = NULL, *srv;
    9999        char *connect_to, *s;
    100100        int i;
     
    196196        if( acc->server && *acc->server )
    197197                connect_to = acc->server;
    198         else if( ( srv = srv_lookup( "xmpp-client", "tcp", jd->server ) ) ||
    199                  ( srv = srv_lookup( "jabber-client", "tcp", jd->server ) ) )
     198        else if( ( srvl = srv_lookup( "xmpp-client", "tcp", jd->server ) ) ||
     199                 ( srvl = srv_lookup( "jabber-client", "tcp", jd->server ) ) )
     200        {
     201                /* Find the lowest-priority one. These usually come
     202                   back in random/shuffled order. Not looking at
     203                   weights etc for now. */
     204                srv = *srvl;
     205                for( i = 1; srvl[i]; i ++ )
     206                        if( srvl[i]->prio < srv->prio )
     207                                srv = srvl[i];
     208               
    200209                connect_to = srv->name;
     210        }
    201211        else
    202212                connect_to = jd->server;
     
    227237                jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, ic );
    228238        }
    229         g_free( srv );
     239        srv_free( srvl );
    230240       
    231241        if( jd->fd == -1 )
Note: See TracChangeset for help on using the changeset viewer.