[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20031 - gnunet/src/gns
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20031 - gnunet/src/gns |
Date: |
Sun, 26 Feb 2012 14:45:30 +0100 |
Author: schanzen
Date: 2012-02-26 14:45:30 +0100 (Sun, 26 Feb 2012)
New Revision: 20031
Modified:
gnunet/src/gns/gnunet-service-gns.c
gnunet/src/gns/namestore_stub_api.c
Log:
-periodic put fix, namestore stub fix
Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-02-26 13:45:13 UTC (rev 20030)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-02-26 13:45:30 UTC (rev 20031)
@@ -1072,6 +1072,10 @@
GNUNET_NAMESTORE_zone_iterator_next(namestore_iter);
}
+/* prototype */
+static void
+update_zone_dht_start(void *cls, const struct GNUNET_SCHEDULER_TaskContext
*tc);
+
/**
* Function used to put all records successively into the DHT.
* FIXME bug here
@@ -1100,7 +1104,9 @@
if (NULL == name) //We're done
{
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Zone iteration finished\n");
GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter);
+ GNUNET_SCHEDULER_add_now (&update_zone_dht_start, NULL);
return;
}
/**
@@ -1141,8 +1147,18 @@
update_zone_dht_start(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Update zone!\n");
- dht_update_interval = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS,
+ if (0 == num_public_records)
+ {
+ dht_update_interval = GNUNET_TIME_relative_multiply(
+ GNUNET_TIME_UNIT_SECONDS,
+ 1);
+ }
+ else
+ {
+ dht_update_interval = GNUNET_TIME_relative_multiply(
+ GNUNET_TIME_UNIT_SECONDS,
(3600/num_public_records));
+ }
num_public_records = 0; //start counting again
namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle,
&zone_hash,
@@ -1221,10 +1237,8 @@
* We have roughly an hour for all records;
*/
dht_update_interval = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS,
- 60); //FIXME from cfg
- //GNUNET_SCHEDULER_add_delayed (dht_update_interval,
- // &update_zone_dht_start,
- // NULL);
+ 1); //FIXME from cfg
+ GNUNET_SCHEDULER_add_now (&update_zone_dht_start, NULL);
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "GNS Init done!\n");
}
Modified: gnunet/src/gns/namestore_stub_api.c
===================================================================
--- gnunet/src/gns/namestore_stub_api.c 2012-02-26 13:45:13 UTC (rev 20030)
+++ gnunet/src/gns/namestore_stub_api.c 2012-02-26 13:45:30 UTC (rev 20031)
@@ -80,6 +80,7 @@
uint32_t no_flags;
uint32_t flags;
struct GNUNET_NAMESTORE_Handle *h;
+ struct GNUNET_NAMESTORE_SimpleRecord *sr;
};
struct GNUNET_NAMESTORE_SimpleRecord
@@ -380,6 +381,7 @@
h->locked = 1;
it = GNUNET_malloc(sizeof(struct GNUNET_NAMESTORE_ZoneIterator));
it->h = h;
+ it->sr = h->records_head;
it->proc = proc;
it->proc_cls = proc_cls;
it->zone = zone;
@@ -392,30 +394,30 @@
void
GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it)
{
- struct GNUNET_NAMESTORE_SimpleRecord *sr;
if (it->h->locked == 0)
return;
+ if (it->sr == NULL)
+ {
+ it->proc(it->proc_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS,
+ NULL, 0, NULL, NULL);
+ return;
+ }
- sr = it->h->records_head;
- for (; sr != NULL; sr = sr->next)
+ if (GNUNET_CRYPTO_hash_cmp(it->sr->zone, it->zone))
{
- if (GNUNET_CRYPTO_hash_cmp(sr->zone, it->zone))
- {
- //Simply always return all records
- //check flags
- it->proc(it->proc_cls, sr->zone_key, GNUNET_TIME_UNIT_FOREVER_ABS,
//FIXME
- sr->name, sr->rd_count, sr->rd, NULL);
- }
+ //Simply always return all records
+ //check flags
+ it->proc(it->proc_cls, it->sr->zone_key, GNUNET_TIME_UNIT_FOREVER_ABS,
+ it->sr->name, it->sr->rd_count, it->sr->rd, NULL);
}
- it->proc(it->proc_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS, NULL, 0, NULL, NULL);
+ it->sr = it->sr->next;
}
void
GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
{
- it->h->locked = 0;
- GNUNET_free(it);
+ //it->h->locked = 0;
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20031 - gnunet/src/gns,
gnunet <=