aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-10-06 12:50:13 +0000
committerChristian Grothoff <christian@grothoff.org>2012-10-06 12:50:13 +0000
commit867f1fee25a4d2816d37006daedda1a40e839ade (patch)
tree89236adada3bb210698c51b06c970296e6b38cc3 /src/util
parentf5c1b7a3b0ef3f6390de711f19cc2eaa8f420406 (diff)
downloadgnunet-867f1fee25a4d2816d37006daedda1a40e839ade.tar.gz
gnunet-867f1fee25a4d2816d37006daedda1a40e839ade.zip
-highly experimental patch to fix #2578, could theoretically cause unexpected problems in unrelated places
Diffstat (limited to 'src/util')
-rw-r--r--src/util/client.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/util/client.c b/src/util/client.c
index 337eade0c..81c696a7b 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -237,6 +237,11 @@ struct GNUNET_CLIENT_Connection
237 int in_receive; 237 int in_receive;
238 238
239 /** 239 /**
240 * Is this the first message we are sending to the service?
241 */
242 int first_message;
243
244 /**
240 * How often have we tried to connect? 245 * How often have we tried to connect?
241 */ 246 */
242 unsigned int attempts; 247 unsigned int attempts;
@@ -419,6 +424,7 @@ GNUNET_CLIENT_connect (const char *service_name,
419 return NULL; 424 return NULL;
420 connection = do_connect (service_name, cfg, 0); 425 connection = do_connect (service_name, cfg, 0);
421 client = GNUNET_malloc (sizeof (struct GNUNET_CLIENT_Connection)); 426 client = GNUNET_malloc (sizeof (struct GNUNET_CLIENT_Connection));
427 client->first_message = GNUNET_YES;
422 client->attempts = 1; 428 client->attempts = 1;
423 client->connection = connection; 429 client->connection = connection;
424 client->service_name = GNUNET_strdup (service_name); 430 client->service_name = GNUNET_strdup (service_name);
@@ -941,6 +947,7 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
941 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 947 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
942 th->client->connection = 948 th->client->connection =
943 do_connect (th->client->service_name, th->client->cfg, th->client->attempts++); 949 do_connect (th->client->service_name, th->client->cfg, th->client->attempts++);
950 th->client->first_message = GNUNET_YES;
944 if (NULL == th->client->connection) 951 if (NULL == th->client->connection)
945 { 952 {
946 /* could happen if we're out of sockets */ 953 /* could happen if we're out of sockets */
@@ -1080,7 +1087,9 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client,
1080 th->client = client; 1087 th->client = client;
1081 th->size = size; 1088 th->size = size;
1082 th->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1089 th->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1083 th->auto_retry = auto_retry; 1090 /* always auto-retry on first message to service */
1091 th->auto_retry = (GNUNET_YES == client->first_message) ? GNUNET_YES : auto_retry;
1092 client->first_message = GNUNET_NO;
1084 th->notify = notify; 1093 th->notify = notify;
1085 th->notify_cls = notify_cls; 1094 th->notify_cls = notify_cls;
1086 th->attempts_left = MAX_ATTEMPTS; 1095 th->attempts_left = MAX_ATTEMPTS;