summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-04 18:30:17 +0000
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-07 10:43:07 +0000
commit28d344a9d11f0d23eab602f6406fa6c86a08d5d9 (patch)
tree0e3e8c87bcc7248bfe2f05c403beae0893fcd2a9 /src
parenteaa219390c1d4347a082579045a69c0e77b3be49 (diff)
remove proxy from the list if we receive an IQ error
Diffstat (limited to 'src')
-rw-r--r--src/bytestream-factory.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index 04655b578..4ce4037dd 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -302,10 +302,18 @@ socks5_proxy_query_reply_cb (GabbleConnection *conn,
gpointer user_data)
{
GabbleBytestreamFactory *self = GABBLE_BYTESTREAM_FACTORY (obj);
+ GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (
+ self);
LmMessageNode *query, *streamhost;
+ const gchar *from;
const gchar *jid, *host, *port;
GabbleSocks5Proxy *proxy;
gboolean fallback = GPOINTER_TO_INT (user_data);
+ GSList *found = NULL;
+
+ from = lm_message_node_get_attribute (reply_msg->node, "from");
+ if (from == NULL)
+ goto fail;
if (lm_message_get_sub_type (reply_msg) != LM_MESSAGE_SUB_TYPE_RESULT)
goto fail;
@@ -333,6 +341,22 @@ socks5_proxy_query_reply_cb (GabbleConnection *conn,
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
fail:
+ if (fallback && from != NULL)
+ {
+ /* Remove the bugged proxy so we won't query it anymore */
+ found = g_slist_find_custom (priv->socks5_potential_proxies,
+ from, (GCompareFunc) strcmp);
+
+ if (found != NULL)
+ {
+ DEBUG ("remove proxy %s", from);
+ g_free (found->data);
+
+ priv->socks5_potential_proxies = g_slist_delete_link (
+ priv->socks5_potential_proxies, found);
+ }
+ }
+
/* Try to get another proxy as this one failed */
query_proxies (self, 1);
return LM_HANDLER_RESULT_REMOVE_MESSAGE;