diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-27 14:46:20 +0000 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-07 10:43:04 +0000 |
commit | 4350f0217a7de9bfb94c9d266abc7facaffb0964 (patch) | |
tree | ffc7491ea1a1cffedcb8ab2dc4b60919bfb6ffad /src/bytestream-factory.c | |
parent | fbad85953c6791382d204c886f17e1eaa4eba5e5 (diff) | |
download | telepathy-gabble-4350f0217a7de9bfb94c9d266abc7facaffb0964.tar.gz |
move existing proxy to the head of the list when they are re-discovered
Diffstat (limited to 'src/bytestream-factory.c')
-rw-r--r-- | src/bytestream-factory.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c index 2c4ce4c00..c6ecea7b9 100644 --- a/src/bytestream-factory.c +++ b/src/bytestream-factory.c @@ -239,6 +239,7 @@ add_proxy_to_list (GabbleBytestreamFactory *self, GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE ( self); GSList **list; + GSList *found; if (fallback) { @@ -249,18 +250,24 @@ add_proxy_to_list (GabbleBytestreamFactory *self, list = &priv->socks5_proxies;; } - if (g_slist_find_custom (*list, proxy, cmp_proxy) != NULL) + found = g_slist_find_custom (*list, proxy, cmp_proxy); + if (found != NULL) { - DEBUG ("%s SOCKS5 proxy (%s %s:%s) is already known; ignoring", + DEBUG ("%s SOCKS5 proxy (%s %s:%s) is already known; " + "move it to the head of the list", fallback ? "Fallback": "Discovered", proxy->jid, proxy->host, proxy->port); - return; + + *list = g_slist_delete_link (*list, found); + } + else + { + DEBUG ("Add %s SOCKS5 proxy: %s %s:%s", + fallback ? "fallback": "discovered", + proxy->jid, proxy->host, proxy->port); } *list = g_slist_prepend (*list, proxy); - - DEBUG ("Add %s SOCKS5 proxy: %s %s:%s", fallback ? "fallback": "discovered", - proxy->jid, proxy->host, proxy->port); } static LmHandlerResult |