- struct GNUNET_GNSRECORD_Block *block;
- struct GNUNET_HashCode query;
- struct GNUNET_TIME_Absolute expire;
- struct GNUNET_TIME_Absolute now;
- size_t block_size;
- struct GNUNET_GNSRECORD_Data rd_public[rd_count];
- unsigned int rd_public_count;
- unsigned int i;
-
- if (NULL == name)
- {
- /* we're done with one iteration, calculate when to do the next one */
- namestore_iter = NULL;
- last_num_public_records = num_public_records;
- first_zone_iteration = GNUNET_NO;
- if (0 == num_public_records)
- {
- /**
- * If no records are known (startup) or none present
- * we can safely set the interval to the value for a single
- * record
- */
- put_interval = zone_publish_time_window;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
- "No records in namestore database.\n");
- }
- else
- {
- put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window,
- num_public_records);
- }
- put_interval = GNUNET_TIME_relative_max (MINIMUM_ZONE_ITERATION_INTERVAL,
- put_interval);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Zone iteration finished. Adjusted zone iteration interval to %s\n",
- GNUNET_STRINGS_relative_time_to_string (put_interval, GNUNET_YES));
- GNUNET_STATISTICS_set (statistics,
- "Current zone iteration interval (in ms)",
- put_interval.rel_value_us / 1000LL,
- GNUNET_NO);
- GNUNET_STATISTICS_update (statistics,
- "Number of zone iterations",
- 1,
- GNUNET_NO);
- GNUNET_STATISTICS_set (statistics,
- "Number of public records in DHT",
- last_num_public_records,
- GNUNET_NO);
- if (0 == num_public_records)
- zone_publish_task = GNUNET_SCHEDULER_add_delayed (put_interval,
- &publish_zone_dht_start,
- NULL);
- else
- zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
- NULL);
- return;
- }
-
- /* filter out records that are not public, and convert to
- absolute expiration time. */
- rd_public_count = 0;
- now = GNUNET_TIME_absolute_get ();
- for (i=0;i<rd_count;i++)
- if (0 == (rd[i].flags & (GNUNET_GNSRECORD_RF_PRIVATE |
- GNUNET_GNSRECORD_RF_PENDING)))
- {
- rd_public[rd_public_count] = rd[i];
- if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
- {
- rd_public[rd_public_count].flags &= ~GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
- rd_public[rd_public_count].expiration_time += now.abs_value_us;
- }
- rd_public_count++;
- }