aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord/gnsrecord_misc.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-11-04 17:04:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-11-04 17:04:28 +0000
commit6c3bf6b3486fd31402ab991f5ddef76bf9cd93c4 (patch)
tree86ff97f084276e63ad6d58fd398b8dc1403199bb /src/gnsrecord/gnsrecord_misc.c
parenta5328c2a96b9582585511c1ce1aee08509eb0c0a (diff)
downloadgnunet-6c3bf6b3486fd31402ab991f5ddef76bf9cd93c4.tar.gz
gnunet-6c3bf6b3486fd31402ab991f5ddef76bf9cd93c4.zip
block expiration
Diffstat (limited to 'src/gnsrecord/gnsrecord_misc.c')
-rw-r--r--src/gnsrecord/gnsrecord_misc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 91cbcf017..315835c04 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -153,9 +153,12 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
153 const struct GNUNET_GNSRECORD_Data *rd) 153 const struct GNUNET_GNSRECORD_Data *rd)
154{ 154{
155 unsigned int c; 155 unsigned int c;
156 unsigned int c2;
156 struct GNUNET_TIME_Absolute expire; 157 struct GNUNET_TIME_Absolute expire;
157 struct GNUNET_TIME_Absolute at; 158 struct GNUNET_TIME_Absolute at;
158 struct GNUNET_TIME_Relative rt; 159 struct GNUNET_TIME_Relative rt;
160 struct GNUNET_TIME_Absolute at_shadow;
161 struct GNUNET_TIME_Relative rt_shadow;
159 162
160 if (NULL == rd) 163 if (NULL == rd)
161 return GNUNET_TIME_UNIT_ZERO_ABS; 164 return GNUNET_TIME_UNIT_ZERO_ABS;
@@ -171,6 +174,26 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
171 { 174 {
172 at.abs_value_us = rd[c].expiration_time; 175 at.abs_value_us = rd[c].expiration_time;
173 } 176 }
177
178 for (c2 = 0; c2 < rd_count; c2++)
179 {
180 /* Check for shadow record */
181 if ((c == c2) ||
182 (rd[c].record_type != rd[c2].record_type) ||
183 (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)))
184 continue;
185 /* We have a shadow record */
186 if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
187 {
188 rt_shadow.rel_value_us = rd[2].expiration_time;
189 at_shadow = GNUNET_TIME_relative_to_absolute (rt_shadow);
190 }
191 else
192 {
193 at_shadow.abs_value_us = rd[c2].expiration_time;
194 }
195 at = GNUNET_TIME_absolute_max (at, at_shadow);
196 }
174 expire = GNUNET_TIME_absolute_min (at, expire); 197 expire = GNUNET_TIME_absolute_min (at, expire);
175 } 198 }
176 LOG (GNUNET_ERROR_TYPE_DEBUG, 199 LOG (GNUNET_ERROR_TYPE_DEBUG,