[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25151 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25151 - gnunet/src/fs |
Date: |
Wed, 28 Nov 2012 15:34:29 +0100 |
Author: grothoff
Date: 2012-11-28 15:34:29 +0100 (Wed, 28 Nov 2012)
New Revision: 25151
Modified:
gnunet/src/fs/gnunet-service-fs_pr.c
Log:
-add retries, and retry limit (#2659)
Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c 2012-11-28 14:33:09 UTC (rev
25150)
+++ gnunet/src/fs/gnunet-service-fs_pr.c 2012-11-28 14:34:29 UTC (rev
25151)
@@ -64,6 +64,13 @@
#define INSANE_STATISTICS GNUNET_NO
/**
+ * If obtaining a block via stream fails, how often do we retry it before
+ * giving up for good (and sticking to non-anonymous transfer)?
+ */
+#define STREAM_RETRY_MAX 3
+
+
+/**
* An active request.
*/
struct GSF_PendingRequest
@@ -166,6 +173,12 @@
uint64_t first_uid;
/**
+ * How often have we retried this request via 'stream'?
+ * (used to bound overall retries).
+ */
+ unsigned int stream_retry_count;
+
+ /**
* Number of valid entries in the 'replies_seen' array.
*/
unsigned int replies_seen_count;
@@ -1181,11 +1194,16 @@
GNUNET_break (0 == data_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Error retrieiving block via stream\n");
- /* FIXME: maybe we should re-try a few times; but then
- we MUST bound the number of re-tries to not keep
- asking indefinitely with fresh streams; this should
- be implemented if/when the stream code gets its
- timeout/parallel-session limits */
+ pr->stream_retry_count++;
+ if (pr->stream_retry_count >= STREAM_RETRY_MAX)
+ return; /* give up on stream */
+ /* retry -- without delay, as this is non-anonymous
+ and mesh/stream connect will take some time anyway */
+ pr->stream_request = GSF_stream_query (pr->public_data.target,
+ &pr->public_data.query,
+ pr->public_data.type,
+ &stream_reply_proc,
+ pr);
return;
}
if (GNUNET_YES !=
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25151 - gnunet/src/fs,
gnunet <=