X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fclient.c;h=d87be74f6d943c1bfdc072906ca6fe8a523b3919;hb=ed28dd2141e77aa073d81089cb5a07e0a0fc013c;hp=11abecfcf3a22f6370e21ac56fc71a073551f30e;hpb=9e308ff38737cc6b1d840eb72d016a7d1e109ea4;p=oweals%2Fgnunet.git diff --git a/src/util/client.c b/src/util/client.c index 11abecfcf..d87be74f6 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2001-2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2001-2013 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** @@ -29,6 +29,7 @@ #include "platform.h" #include "gnunet_protocols.h" #include "gnunet_util_lib.h" +#include "gnunet_socks.h" /** @@ -70,7 +71,7 @@ struct GNUNET_CLIENT_TransmitHandle * If we are re-trying and are delaying to do so, * handle to the scheduled task managing the delay. */ - struct GNUNET_SCHEDULER_Task * reconnect_task; + struct GNUNET_SCHEDULER_Task *reconnect_task; /** * Timeout for the operation overall. @@ -339,6 +340,10 @@ do_connect (const char *service_name, char *hostname; unsigned long long port; + /* Never use a local source if a proxy is configured */ + if (GNUNET_YES == GNUNET_SOCKS_check_service (service_name,cfg)) + return GNUNET_SOCKS_do_connect (service_name,cfg); + connection = NULL; if (0 == (attempt % 2)) { @@ -531,6 +536,8 @@ receive_helper (void *cls, (unsigned int) available, NULL == client->connection ? "NULL" : "non-NULL", STRERROR (errCode)); + /* remember failure */ + client->in_receive = GNUNET_SYSERR; if (NULL != (receive_handler = client->receiver_handler)) { receive_handler_cls = client->receiver_handler_cls; @@ -538,8 +545,6 @@ receive_helper (void *cls, receive_handler (receive_handler_cls, NULL); } - /* remember failure */ - client->in_receive = GNUNET_SYSERR; return; } /* FIXME: optimize for common fast case where buf contains the @@ -1108,6 +1113,7 @@ client_delayed_retry (void *cls, "Transmission failed %u times, trying again in %s.\n", MAX_ATTEMPTS - th->attempts_left, GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); + GNUNET_assert (NULL == th->th); GNUNET_assert (NULL == th->reconnect_task); th->reconnect_task = GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); @@ -1191,6 +1197,7 @@ client_notify (void *cls, GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); client->th = th; GNUNET_assert (NULL == th->reconnect_task); + GNUNET_assert (NULL == th->th); th->reconnect_task = GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); return 0; @@ -1259,6 +1266,7 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client, client->th = th; if (NULL == client->connection) { + GNUNET_assert (NULL == th->th); GNUNET_assert (NULL == th->reconnect_task); th->reconnect_task = GNUNET_SCHEDULER_add_delayed (client->back_off,