aboutsummaryrefslogtreecommitdiff
path: root/src/zonemaster/gnunet-service-zonemaster.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-02-06 14:30:00 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-02-06 14:30:00 +0100
commit215032563755ba48d4e871b82c9c6697611726f8 (patch)
tree51123c26b3d1418d0d400593438e23da48a8b4c8 /src/zonemaster/gnunet-service-zonemaster.c
parentd322de96b95a7afad7f5bd255bf70642840a3778 (diff)
downloadgnunet-215032563755ba48d4e871b82c9c6697611726f8.tar.gz
gnunet-215032563755ba48d4e871b82c9c6697611726f8.zip
-simlify and correct tombstone logic
Diffstat (limited to 'src/zonemaster/gnunet-service-zonemaster.c')
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c88
1 files changed, 4 insertions, 84 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c
index 9f0de8a54..9eb3432ee 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -29,7 +29,6 @@
29#include "gnunet_dht_service.h" 29#include "gnunet_dht_service.h"
30#include "gnunet_namestore_service.h" 30#include "gnunet_namestore_service.h"
31#include "gnunet_statistics_service.h" 31#include "gnunet_statistics_service.h"
32#include "zonemaster_misc.h"
33 32
34#define LOG_STRERROR_FILE(kind, syscall, \ 33#define LOG_STRERROR_FILE(kind, syscall, \
35 filename) GNUNET_log_from_strerror_file (kind, "util", \ 34 filename) GNUNET_log_from_strerror_file (kind, "util", \
@@ -91,30 +90,6 @@
91#define DHT_GNS_REPLICATION_LEVEL 5 90#define DHT_GNS_REPLICATION_LEVEL 5
92 91
93/** 92/**
94 * Handle for tombston updates which are executed for each published
95 * record set.
96 */
97struct TombstoneActivity
98{
99 /**
100 * Kept in a DLL.
101 */
102 struct TombstoneActivity *next;
103
104 /**
105 * Kept in a DLL.
106 */
107 struct TombstoneActivity *prev;
108
109 /**
110 * Handle for the store operation.
111 */
112 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
113
114};
115
116
117/**
118 * Handle for DHT PUT activity triggered from the namestore monitor. 93 * Handle for DHT PUT activity triggered from the namestore monitor.
119 */ 94 */
120struct DhtPutActivity 95struct DhtPutActivity
@@ -172,16 +147,6 @@ static struct DhtPutActivity *it_head;
172static struct DhtPutActivity *it_tail; 147static struct DhtPutActivity *it_tail;
173 148
174/** 149/**
175 * Head of the tombstone operations
176 */
177static struct TombstoneActivity *ta_head;
178
179/**
180 * Tail of the tombstone operations
181 */
182static struct TombstoneActivity *ta_tail;
183
184/**
185 * Number of entries in the DHT queue #it_head. 150 * Number of entries in the DHT queue #it_head.
186 */ 151 */
187static unsigned int dht_queue_length; 152static unsigned int dht_queue_length;
@@ -296,14 +261,6 @@ shutdown_task (void *cls)
296 dht_queue_length--; 261 dht_queue_length--;
297 GNUNET_free (ma); 262 GNUNET_free (ma);
298 } 263 }
299 while (NULL != (ta = ta_head))
300 {
301 GNUNET_NAMESTORE_cancel (ta->ns_qe);
302 GNUNET_CONTAINER_DLL_remove (ta_head,
303 ta_tail,
304 ta);
305 GNUNET_free (ta);
306 }
307 if (NULL != statistics) 264 if (NULL != statistics)
308 { 265 {
309 GNUNET_STATISTICS_destroy (statistics, 266 GNUNET_STATISTICS_destroy (statistics,
@@ -713,21 +670,6 @@ zone_iteration_finished (void *cls)
713 } 670 }
714} 671}
715 672
716static void
717ts_store_cont (void *cls, int32_t success, const char *emsg)
718{
719 struct TombstoneActivity *ta = cls;
720
721 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
722 "Tombstone update complete\n");
723 GNUNET_CONTAINER_DLL_remove (ta_head,
724 ta_tail,
725 ta);
726 GNUNET_free (ta);
727
728}
729
730
731/** 673/**
732 * Function used to put all records successively into the DHT. 674 * Function used to put all records successively into the DHT.
733 * 675 *
@@ -749,15 +691,14 @@ put_gns_record (void *cls,
749 unsigned int rd_public_count; 691 unsigned int rd_public_count;
750 unsigned int rd_fresh_count = 0; 692 unsigned int rd_fresh_count = 0;
751 struct DhtPutActivity *ma; 693 struct DhtPutActivity *ma;
752 struct TombstoneActivity *ta;
753 struct GNUNET_TIME_Absolute expire; 694 struct GNUNET_TIME_Absolute expire;
754 695
755 (void) cls; 696 (void) cls;
756 ns_iteration_left--; 697 ns_iteration_left--;
757 rd_public_count = ZMSTR_convert_records_for_export (rd, 698 rd_public_count = GNUNET_GNSRECORD_convert_records_for_export (rd,
758 rd_count, 699 rd_count,
759 rd_public, 700 rd_public,
760 &expire); 701 &expire);
761 if (0 == rd_public_count) 702 if (0 == rd_public_count)
762 { 703 {
763 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 704 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -790,27 +731,6 @@ put_gns_record (void *cls,
790 rd_public_count, 731 rd_public_count,
791 expire, 732 expire,
792 ma); 733 ma);
793 ta = GNUNET_new (struct TombstoneActivity);
794 ZMSTR_touch_tombstone (key,
795 label,
796 rd,
797 rd_count,
798 rd_fresh,
799 &rd_fresh_count,
800 expire);
801 ta->ns_qe = GNUNET_NAMESTORE_records_store_ (namestore_handle,
802 key,
803 label,
804 rd_fresh_count,
805 rd_fresh,
806 GNUNET_YES,
807 &ts_store_cont,
808 ta);
809
810
811 GNUNET_CONTAINER_DLL_insert_tail (ta_head,
812 ta_tail,
813 ta);
814 put_cnt++; 734 put_cnt++;
815 if (0 == put_cnt % DELTA_INTERVAL) 735 if (0 == put_cnt % DELTA_INTERVAL)
816 update_velocity (DELTA_INTERVAL); 736 update_velocity (DELTA_INTERVAL);