diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-04 17:00:35 +0000 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-07 10:43:07 +0000 |
commit | bf9b340bfd4333cc8b7c3e797b416724b956d8cc (patch) | |
tree | 7928800e808bcb26c6d4b074451a7ed379aa6af5 | |
parent | e2c73522d5275d4e787a19fd5d79d97cac898845 (diff) |
proxies_disco_cb: Replace the old list instead of adding elements to it
-rw-r--r-- | src/bytestream-factory.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c index 69264ae17..e63495f74 100644 --- a/src/bytestream-factory.c +++ b/src/bytestream-factory.c @@ -437,6 +437,7 @@ proxies_disco_cb (GabbleDisco *disco, GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE ( self); NodeIter i; + GSList *new_list = NULL; priv->proxies_list_expired = FALSE; @@ -457,16 +458,18 @@ proxies_disco_cb (GabbleDisco *disco, DEBUG ("Discovered proxy %s", jid); - priv->socks5_potential_proxies = g_slist_prepend ( - priv->socks5_potential_proxies, g_strdup (jid)); + new_list = g_slist_prepend (new_list, g_strdup (jid)); } - if (priv->socks5_potential_proxies == NULL) + if (new_list == NULL) return; + /* replace the old list by the new one */ + g_slist_foreach (priv->socks5_potential_proxies, (GFunc) g_free, NULL); + g_slist_free (priv->socks5_potential_proxies); + /* randomize the list to not always use the same proxies */ - priv->socks5_potential_proxies = randomize_g_slist ( - priv->socks5_potential_proxies); + priv->socks5_potential_proxies = randomize_g_slist (new_list); priv->next_query = priv->socks5_potential_proxies; gabble_bytestream_factory_query_socks5_proxies (self); |