diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-06-16 12:05:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-06-16 12:05:46 +0000 |
commit | 774fb63daa28f0effa2742ab894f55c2bc3aee39 (patch) | |
tree | 66cca922ea2d4c612ed78ce051945b97b118a561 | |
parent | b365d74222adc5fc86eb5803569904f8fa8958af (diff) | |
download | gnunet-774fb63daa28f0effa2742ab894f55c2bc3aee39.tar.gz gnunet-774fb63daa28f0effa2742ab894f55c2bc3aee39.zip |
fix
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 10be10e12..5e21e35ca 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -31,6 +31,10 @@ | |||
31 | #include "gnunet-service-fs_pe.h" | 31 | #include "gnunet-service-fs_pe.h" |
32 | #include "gnunet-service-fs_pr.h" | 32 | #include "gnunet-service-fs_pr.h" |
33 | 33 | ||
34 | /** | ||
35 | * Hard limit on the number of results we may get from the datastore per query. | ||
36 | */ | ||
37 | #define MAX_RESULTS (100 * 1024) | ||
34 | 38 | ||
35 | /** | 39 | /** |
36 | * An active request. | 40 | * An active request. |
@@ -141,7 +145,7 @@ struct GSF_PendingRequest | |||
141 | /** | 145 | /** |
142 | * Do we have a first UID yet? | 146 | * Do we have a first UID yet? |
143 | */ | 147 | */ |
144 | int have_first_uid; | 148 | unsigned int have_first_uid; |
145 | 149 | ||
146 | }; | 150 | }; |
147 | 151 | ||
@@ -1145,7 +1149,7 @@ process_local_reply (void *cls, | |||
1145 | if (GNUNET_NO == pr->have_first_uid) | 1149 | if (GNUNET_NO == pr->have_first_uid) |
1146 | { | 1150 | { |
1147 | pr->first_uid = uid; | 1151 | pr->first_uid = uid; |
1148 | pr->have_first_uid = GNUNET_YES; | 1152 | pr->have_first_uid = 1; |
1149 | } | 1153 | } |
1150 | else | 1154 | else |
1151 | { | 1155 | { |
@@ -1157,6 +1161,15 @@ process_local_reply (void *cls, | |||
1157 | GNUNET_NO); | 1161 | GNUNET_NO); |
1158 | key = NULL; /* all replies seen! */ | 1162 | key = NULL; /* all replies seen! */ |
1159 | } | 1163 | } |
1164 | pr->have_first_uid++; | ||
1165 | if (pr->have_first_uid > MAX_RESULTS) | ||
1166 | { | ||
1167 | GNUNET_STATISTICS_update (GSF_stats, | ||
1168 | gettext_noop ("# Datastore lookups aborted (more than MAX_RESULTS)"), | ||
1169 | 1, | ||
1170 | GNUNET_NO); | ||
1171 | key = NULL; /* all replies seen! */ | ||
1172 | } | ||
1160 | } | 1173 | } |
1161 | if (NULL == key) | 1174 | if (NULL == key) |
1162 | { | 1175 | { |