summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-04 17:16:13 +0000
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-07 10:43:07 +0000
commitb43ca913add25cc76ed10e8b6643d866419aa348 (patch)
tree866f69201c084cc7fa514f3f5f9be7c1035ab5d4 /src
parentbf9b340bfd4333cc8b7c3e797b416724b956d8cc (diff)
Always recycle the socks5_potential_proxies list
We ensure that we won't query twice the same proxy by clamping the number of proxy needed to the length of the list of the potential proxies. This add the nice side effect of prioritizing a different proxy every time.
Diffstat (limited to 'src')
-rw-r--r--src/bytestream-factory.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index e63495f74..92eb39076 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -382,27 +382,16 @@ query_proxies (GabbleBytestreamFactory *self,
self);
guint i;
+ /* We don't want to query more than once the same proxy */
+ nb_proxies_needed = MIN (nb_proxies_needed,
+ g_slist_length (priv->socks5_potential_proxies));
+
for (i = 0; i < nb_proxies_needed; i++)
{
gchar *jid;
if (priv->next_query == NULL)
- {
- if (g_slist_length (priv->socks5_potential_proxies) >
- FALLBACK_PROXY_CACHE_SIZE)
- {
- /* recycle the proxies list */
- priv->next_query = priv->socks5_potential_proxies;
- }
- else
- {
- /* There is no point to recycle the list as we'll never exceed
- * the size of the cache. Furthermore, if we have, say, one
- * proxy we don't want to flood it with useless requests. */
- DEBUG ("Can't recycle proxies list");
- return;
- }
- }
+ priv->next_query = priv->socks5_potential_proxies;
jid = priv->next_query->data;
send_proxy_query (self, jid, TRUE);