diff options
Diffstat (limited to 'src/dht/gnunet-service-dht_datacache.c')
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 36047d561..7ad9aa728 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011, 2015, 2017 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2011, 2015, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file dht/gnunet-service-dht_datacache.c | 19 | * @file dht/gnunet-service-dht_datacache.c |
@@ -26,6 +24,7 @@ | |||
26 | #include "platform.h" | 24 | #include "platform.h" |
27 | #include "gnunet_datacache_lib.h" | 25 | #include "gnunet_datacache_lib.h" |
28 | #include "gnunet-service-dht_datacache.h" | 26 | #include "gnunet-service-dht_datacache.h" |
27 | #include "gnunet-service-dht_neighbours.h" | ||
29 | #include "gnunet-service-dht_routing.h" | 28 | #include "gnunet-service-dht_routing.h" |
30 | #include "gnunet-service-dht.h" | 29 | #include "gnunet-service-dht.h" |
31 | 30 | ||
@@ -79,10 +78,13 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
79 | } | 78 | } |
80 | /* Put size is actual data size plus struct overhead plus path length (if any) */ | 79 | /* Put size is actual data size plus struct overhead plus path length (if any) */ |
81 | GNUNET_STATISTICS_update (GDS_stats, | 80 | GNUNET_STATISTICS_update (GDS_stats, |
82 | gettext_noop ("# ITEMS stored in datacache"), 1, | 81 | gettext_noop ("# ITEMS stored in datacache"), |
82 | 1, | ||
83 | GNUNET_NO); | 83 | GNUNET_NO); |
84 | r = GNUNET_DATACACHE_put (datacache, | 84 | r = GNUNET_DATACACHE_put (datacache, |
85 | key, | 85 | key, |
86 | GNUNET_CRYPTO_hash_matching_bits (key, | ||
87 | &my_identity_hash), | ||
86 | data_size, | 88 | data_size, |
87 | data, | 89 | data, |
88 | type, | 90 | type, |
@@ -169,6 +171,11 @@ datacache_get_iterator (void *cls, | |||
169 | struct GetRequestContext *ctx = cls; | 171 | struct GetRequestContext *ctx = cls; |
170 | enum GNUNET_BLOCK_EvaluationResult eval; | 172 | enum GNUNET_BLOCK_EvaluationResult eval; |
171 | 173 | ||
174 | if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us) | ||
175 | { | ||
176 | GNUNET_break (0); /* why does datacache return expired values? */ | ||
177 | return GNUNET_OK; /* skip expired record */ | ||
178 | } | ||
172 | if ( (NULL == data) && | 179 | if ( (NULL == data) && |
173 | (0 == data_size) ) | 180 | (0 == data_size) ) |
174 | data = &non_null; /* point anywhere, but not to NULL */ | 181 | data = &non_null; /* point anywhere, but not to NULL */ |