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.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster-monitor.c b/src/zonemaster/gnunet-service-zonemaster-monitor.c
index 748a0f342..08749bede 100644
--- a/src/zonemaster/gnunet-service-zonemaster-monitor.c
+++ b/src/zonemaster/gnunet-service-zonemaster-monitor.c
@@ -273,19 +273,17 @@ perform_dht_put (const struct GNUNET_IDENTITY_PrivateKey *key,
273 * @param label label of the records; NULL on disconnect 273 * @param label label of the records; NULL on disconnect
274 * @param rd_count number of entries in @a rd array, 0 if label was deleted 274 * @param rd_count number of entries in @a rd array, 0 if label was deleted
275 * @param rd array of records with data to store 275 * @param rd array of records with data to store
276 * @param expire expiration of this record set
276 */ 277 */
277static void 278static void
278handle_monitor_event (void *cls, 279handle_monitor_event (void *cls,
279 const struct GNUNET_IDENTITY_PrivateKey *zone, 280 const struct GNUNET_IDENTITY_PrivateKey *zone,
280 const char *label, 281 const char *label,
281 unsigned int rd_count, 282 unsigned int rd_count,
282 const struct GNUNET_GNSRECORD_Data *rd) 283 const struct GNUNET_GNSRECORD_Data *rd,
284 struct GNUNET_TIME_Absolute expire)
283{ 285{
284 struct GNUNET_GNSRECORD_Data rd_public[rd_count];
285 unsigned int rd_public_count;
286 struct DhtPutActivity *ma; 286 struct DhtPutActivity *ma;
287 struct GNUNET_TIME_Absolute expire;
288 char *emsg;
289 287
290 (void) cls; 288 (void) cls;
291 GNUNET_STATISTICS_update (statistics, 289 GNUNET_STATISTICS_update (statistics,
@@ -296,24 +294,7 @@ handle_monitor_event (void *cls,
296 "Received %u records for label `%s' via namestore monitor\n", 294 "Received %u records for label `%s' via namestore monitor\n",
297 rd_count, 295 rd_count,
298 label); 296 label);
299 /* filter out records that are not public, and convert to 297 if (0 == rd_count)
300 absolute expiration time. */
301 if (GNUNET_OK != GNUNET_GNSRECORD_convert_records_for_export (label,
302 rd,
303 rd_count,
304 rd_public,
305 &rd_public_count,
306 &expire,
307 &emsg))
308 {
309 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
310 "Zonemaster-monitor failed: %s\n", emsg);
311 GNUNET_free (emsg);
312 GNUNET_NAMESTORE_zone_monitor_next (zmon,
313 1);
314 return; /* nothing to do */
315 }
316 if (0 == rd_public_count)
317 { 298 {
318 GNUNET_NAMESTORE_zone_monitor_next (zmon, 299 GNUNET_NAMESTORE_zone_monitor_next (zmon,
319 1); 300 1);
@@ -323,8 +304,8 @@ handle_monitor_event (void *cls,
323 ma->start_date = GNUNET_TIME_absolute_get (); 304 ma->start_date = GNUNET_TIME_absolute_get ();
324 ma->ph = perform_dht_put (zone, 305 ma->ph = perform_dht_put (zone,
325 label, 306 label,
326 rd_public, 307 rd,
327 rd_public_count, 308 rd_count,
328 expire, 309 expire,
329 ma); 310 ma);
330 if (NULL == ma->ph) 311 if (NULL == ma->ph)
@@ -427,15 +408,16 @@ run (void *cls,
427 /* Schedule periodic put for our records. */ 408 /* Schedule periodic put for our records. */
428 statistics = GNUNET_STATISTICS_create ("zonemaster-mon", 409 statistics = GNUNET_STATISTICS_create ("zonemaster-mon",
429 c); 410 c);
430 zmon = GNUNET_NAMESTORE_zone_monitor_start (c, 411 zmon = GNUNET_NAMESTORE_zone_monitor_start2 (c,
431 NULL, 412 NULL,
432 GNUNET_NO, 413 GNUNET_NO,
433 &handle_monitor_error, 414 &handle_monitor_error,
434 NULL, 415 NULL,
435 &handle_monitor_event, 416 &handle_monitor_event,
436 NULL, 417 NULL,
437 NULL /* sync_cb */, 418 NULL /* sync_cb */,
438 NULL); 419 NULL,
420 GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE);
439 GNUNET_NAMESTORE_zone_monitor_next (zmon, 421 GNUNET_NAMESTORE_zone_monitor_next (zmon,
440 NAMESTORE_QUEUE_LIMIT - 1); 422 NAMESTORE_QUEUE_LIMIT - 1);
441 GNUNET_break (NULL != zmon); 423 GNUNET_break (NULL != zmon);