[telepathy-gabble/master] don't recycle proxies list if that doesn't make sense

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Dec 4 05:41:09 PST 2009


---
 src/bytestream-factory.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index d106678..3b8f455 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -412,8 +412,20 @@ gabble_bytestream_factory_query_socks5_proxies (GabbleBytestreamFactory *self)
 
       if (priv->next_query == NULL)
         {
-          /* recycle the proxies list */
-          priv->next_query = priv->socks5_potential_proxies;
+          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");
+              break;
+            }
         }
 
       jid = priv->next_query->data;
-- 
1.5.6.5




More information about the telepathy-commits mailing list