aboutsummaryrefslogtreecommitdiff
path: root/src/zonemaster/gnunet-service-zonemaster-monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/zonemaster/gnunet-service-zonemaster-monitor.c')
-rw-r--r--src/zonemaster/gnunet-service-zonemaster-monitor.c89
1 files changed, 4 insertions, 85 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster-monitor.c b/src/zonemaster/gnunet-service-zonemaster-monitor.c
index dcacec60f..fef9e6b82 100644
--- a/src/zonemaster/gnunet-service-zonemaster-monitor.c
+++ b/src/zonemaster/gnunet-service-zonemaster-monitor.c
@@ -28,7 +28,6 @@
28#include "gnunet_dht_service.h" 28#include "gnunet_dht_service.h"
29#include "gnunet_namestore_service.h" 29#include "gnunet_namestore_service.h"
30#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
31#include "zonemaster_misc.h"
32 31
33#define LOG_STRERROR_FILE(kind, syscall, \ 32#define LOG_STRERROR_FILE(kind, syscall, \
34 filename) GNUNET_log_from_strerror_file (kind, "util", \ 33 filename) GNUNET_log_from_strerror_file (kind, "util", \
@@ -59,30 +58,6 @@
59#define DHT_GNS_REPLICATION_LEVEL 5 58#define DHT_GNS_REPLICATION_LEVEL 5
60 59
61/** 60/**
62 * Handle for tombston updates which are executed for each published
63 * record set.
64 */
65struct TombstoneActivity
66{
67 /**
68 * Kept in a DLL.
69 */
70 struct TombstoneActivity *next;
71
72 /**
73 * Kept in a DLL.
74 */
75 struct TombstoneActivity *prev;
76
77 /**
78 * Handle for the store operation.
79 */
80 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
81
82};
83
84
85/**
86 * Handle for DHT PUT activity triggered from the namestore monitor. 61 * Handle for DHT PUT activity triggered from the namestore monitor.
87 */ 62 */
88struct DhtPutActivity 63struct DhtPutActivity
@@ -130,17 +105,6 @@ static struct GNUNET_NAMESTORE_Handle *namestore_handle;
130static struct GNUNET_NAMESTORE_ZoneMonitor *zmon; 105static struct GNUNET_NAMESTORE_ZoneMonitor *zmon;
131 106
132/** 107/**
133 * Head of the tombstone operations
134 */
135static struct TombstoneActivity *ta_head;
136
137/**
138 * Tail of the tombstone operations
139 */
140static struct TombstoneActivity *ta_tail;
141
142
143/**
144 * Head of monitor activities; kept in a DLL. 108 * Head of monitor activities; kept in a DLL.
145 */ 109 */
146static struct DhtPutActivity *ma_head; 110static struct DhtPutActivity *ma_head;
@@ -186,14 +150,6 @@ shutdown_task (void *cls)
186 ma); 150 ma);
187 GNUNET_free (ma); 151 GNUNET_free (ma);
188 } 152 }
189 while (NULL != (ta = ta_head))
190 {
191 GNUNET_NAMESTORE_cancel (ta->ns_qe);
192 GNUNET_CONTAINER_DLL_remove (ta_head,
193 ta_tail,
194 ta);
195 GNUNET_free (ta);
196 }
197 if (NULL != statistics) 153 if (NULL != statistics)
198 { 154 {
199 GNUNET_STATISTICS_destroy (statistics, 155 GNUNET_STATISTICS_destroy (statistics,
@@ -309,21 +265,6 @@ perform_dht_put (const struct GNUNET_IDENTITY_PrivateKey *key,
309 return ret; 265 return ret;
310} 266}
311 267
312static void
313ts_store_cont (void *cls, int32_t success, const char *emsg)
314{
315 struct TombstoneActivity *ta = cls;
316
317 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
318 "Tombstone update complete\n");
319 GNUNET_CONTAINER_DLL_remove (ta_head,
320 ta_tail,
321 ta);
322 GNUNET_free (ta);
323
324}
325
326
327/** 268/**
328 * Process a record that was stored in the namestore 269 * Process a record that was stored in the namestore
329 * (invoked by the monitor). 270 * (invoked by the monitor).
@@ -346,7 +287,6 @@ handle_monitor_event (void *cls,
346 unsigned int rd_public_count; 287 unsigned int rd_public_count;
347 unsigned int rd_fresh_count; 288 unsigned int rd_fresh_count;
348 struct DhtPutActivity *ma; 289 struct DhtPutActivity *ma;
349 struct TombstoneActivity *ta;
350 struct GNUNET_TIME_Absolute expire; 290 struct GNUNET_TIME_Absolute expire;
351 291
352 (void) cls; 292 (void) cls;
@@ -360,10 +300,10 @@ handle_monitor_event (void *cls,
360 label); 300 label);
361 /* filter out records that are not public, and convert to 301 /* filter out records that are not public, and convert to
362 absolute expiration time. */ 302 absolute expiration time. */
363 rd_public_count = ZMSTR_convert_records_for_export (rd, 303 rd_public_count = GNUNET_GNSRECORD_convert_records_for_export (rd,
364 rd_count, 304 rd_count,
365 rd_public, 305 rd_public,
366 &expire); 306 &expire);
367 if (0 == rd_public_count) 307 if (0 == rd_public_count)
368 { 308 {
369 GNUNET_NAMESTORE_zone_monitor_next (zmon, 309 GNUNET_NAMESTORE_zone_monitor_next (zmon,
@@ -378,27 +318,6 @@ handle_monitor_event (void *cls,
378 rd_count, 318 rd_count,
379 expire, 319 expire,
380 ma); 320 ma);
381 ta = GNUNET_new (struct TombstoneActivity);
382 ZMSTR_touch_tombstone (zone,
383 label,
384 rd,
385 rd_count,
386 rd_fresh,
387 &rd_fresh_count,
388 expire);
389 ta->ns_qe = GNUNET_NAMESTORE_records_store_ (namestore_handle,
390 zone,
391 label,
392 rd_fresh_count,
393 rd_fresh,
394 GNUNET_YES,
395 &ts_store_cont,
396 ta);
397
398
399 GNUNET_CONTAINER_DLL_insert_tail (ta_head,
400 ta_tail,
401 ta);
402 if (NULL == ma->ph) 321 if (NULL == ma->ph)
403 { 322 {
404 /* PUT failed, do not remember operation */ 323 /* PUT failed, do not remember operation */