diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-24 23:28:24 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-24 23:28:24 +0200 |
commit | bdbb7c684f2c9711989d2543ecc08a95be23e6c4 (patch) | |
tree | 28c453ab36c79aa5058ec64f4b42889216098c5a /src | |
parent | 72b802f9173bdd0f5d6830c56d7c51c3349073fe (diff) | |
download | gnunet-bdbb7c684f2c9711989d2543ecc08a95be23e6c4.tar.gz gnunet-bdbb7c684f2c9711989d2543ecc08a95be23e6c4.zip |
code cleanup, more diagnostics, more statistics
Diffstat (limited to 'src')
-rw-r--r-- | src/gnsrecord/gnsrecord_crypto.c | 66 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 7 | ||||
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 43 | ||||
-rw-r--r-- | src/zonemaster/gnunet-service-zonemaster.c | 44 |
4 files changed, 118 insertions, 42 deletions
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c index 0fab97f06..dd628ea76 100644 --- a/src/gnsrecord/gnsrecord_crypto.c +++ b/src/gnsrecord/gnsrecord_crypto.c | |||
@@ -85,7 +85,8 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
85 | const struct GNUNET_GNSRECORD_Data *rd, | 85 | const struct GNUNET_GNSRECORD_Data *rd, |
86 | unsigned int rd_count) | 86 | unsigned int rd_count) |
87 | { | 87 | { |
88 | size_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count, rd); | 88 | size_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count, |
89 | rd); | ||
89 | char payload[sizeof (uint32_t) + payload_len]; | 90 | char payload[sizeof (uint32_t) + payload_len]; |
90 | struct GNUNET_GNSRECORD_Block *block; | 91 | struct GNUNET_GNSRECORD_Block *block; |
91 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 92 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
@@ -94,14 +95,13 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
94 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; | 95 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
95 | struct GNUNET_GNSRECORD_Data rdc[rd_count]; | 96 | struct GNUNET_GNSRECORD_Data rdc[rd_count]; |
96 | uint32_t rd_count_nbo; | 97 | uint32_t rd_count_nbo; |
97 | unsigned int i; | ||
98 | struct GNUNET_TIME_Absolute now; | 98 | struct GNUNET_TIME_Absolute now; |
99 | 99 | ||
100 | if (payload_len > GNUNET_GNSRECORD_MAX_BLOCK_SIZE) | 100 | if (payload_len > GNUNET_GNSRECORD_MAX_BLOCK_SIZE) |
101 | return NULL; | 101 | return NULL; |
102 | /* convert relative to absolute times */ | 102 | /* convert relative to absolute times */ |
103 | now = GNUNET_TIME_absolute_get (); | 103 | now = GNUNET_TIME_absolute_get (); |
104 | for (i=0;i<rd_count;i++) | 104 | for (unsigned int i=0;i<rd_count;i++) |
105 | { | 105 | { |
106 | rdc[i] = rd[i]; | 106 | rdc[i] = rd[i]; |
107 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | 107 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) |
@@ -116,13 +116,19 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
116 | } | 116 | } |
117 | /* serialize */ | 117 | /* serialize */ |
118 | rd_count_nbo = htonl (rd_count); | 118 | rd_count_nbo = htonl (rd_count); |
119 | GNUNET_memcpy (payload, &rd_count_nbo, sizeof (uint32_t)); | 119 | GNUNET_memcpy (payload, |
120 | &rd_count_nbo, | ||
121 | sizeof (uint32_t)); | ||
120 | GNUNET_assert (payload_len == | 122 | GNUNET_assert (payload_len == |
121 | GNUNET_GNSRECORD_records_serialize (rd_count, rdc, | 123 | GNUNET_GNSRECORD_records_serialize (rd_count, |
122 | payload_len, &payload[sizeof (uint32_t)])); | 124 | rdc, |
125 | payload_len, | ||
126 | &payload[sizeof (uint32_t)])); | ||
123 | block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block) + | 127 | block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block) + |
124 | sizeof (uint32_t) + payload_len); | 128 | sizeof (uint32_t) + |
125 | block->purpose.size = htonl (sizeof (uint32_t) + payload_len + | 129 | payload_len); |
130 | block->purpose.size = htonl (sizeof (uint32_t) + | ||
131 | payload_len + | ||
126 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 132 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
127 | sizeof (struct GNUNET_TIME_AbsoluteNBO)); | 133 | sizeof (struct GNUNET_TIME_AbsoluteNBO)); |
128 | block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); | 134 | block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); |
@@ -132,18 +138,23 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
132 | label, | 138 | label, |
133 | "gns"); | 139 | "gns"); |
134 | GNUNET_CRYPTO_ecdsa_key_get_public (dkey, | 140 | GNUNET_CRYPTO_ecdsa_key_get_public (dkey, |
135 | &block->derived_key); | 141 | &block->derived_key); |
136 | GNUNET_CRYPTO_ecdsa_key_get_public (key, | 142 | GNUNET_CRYPTO_ecdsa_key_get_public (key, |
137 | &pkey); | 143 | &pkey); |
138 | derive_block_aes_key (&iv, &skey, label, &pkey); | 144 | derive_block_aes_key (&iv, |
145 | &skey, | ||
146 | label, | ||
147 | &pkey); | ||
139 | GNUNET_break (payload_len + sizeof (uint32_t) == | 148 | GNUNET_break (payload_len + sizeof (uint32_t) == |
140 | GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len + sizeof (uint32_t), | 149 | GNUNET_CRYPTO_symmetric_encrypt (payload, |
141 | &skey, &iv, | 150 | payload_len + sizeof (uint32_t), |
151 | &skey, | ||
152 | &iv, | ||
142 | &block[1])); | 153 | &block[1])); |
143 | if (GNUNET_OK != | 154 | if (GNUNET_OK != |
144 | GNUNET_CRYPTO_ecdsa_sign (dkey, | 155 | GNUNET_CRYPTO_ecdsa_sign (dkey, |
145 | &block->purpose, | 156 | &block->purpose, |
146 | &block->signature)) | 157 | &block->signature)) |
147 | { | 158 | { |
148 | GNUNET_break (0); | 159 | GNUNET_break (0); |
149 | GNUNET_free (dkey); | 160 | GNUNET_free (dkey); |
@@ -166,9 +177,9 @@ int | |||
166 | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) | 177 | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) |
167 | { | 178 | { |
168 | return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, | 179 | return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, |
169 | &block->purpose, | 180 | &block->purpose, |
170 | &block->signature, | 181 | &block->signature, |
171 | &block->derived_key); | 182 | &block->derived_key); |
172 | } | 183 | } |
173 | 184 | ||
174 | 185 | ||
@@ -224,9 +235,7 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
224 | } | 235 | } |
225 | { | 236 | { |
226 | struct GNUNET_GNSRECORD_Data rd[rd_count]; | 237 | struct GNUNET_GNSRECORD_Data rd[rd_count]; |
227 | unsigned int i; | ||
228 | unsigned int j; | 238 | unsigned int j; |
229 | unsigned int k; | ||
230 | struct GNUNET_TIME_Absolute now; | 239 | struct GNUNET_TIME_Absolute now; |
231 | 240 | ||
232 | if (GNUNET_OK != | 241 | if (GNUNET_OK != |
@@ -241,7 +250,7 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
241 | /* hide expired records */ | 250 | /* hide expired records */ |
242 | now = GNUNET_TIME_absolute_get (); | 251 | now = GNUNET_TIME_absolute_get (); |
243 | j = 0; | 252 | j = 0; |
244 | for (i=0;i<rd_count;i++) | 253 | for (unsigned int i=0;i<rd_count;i++) |
245 | { | 254 | { |
246 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | 255 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) |
247 | { | 256 | { |
@@ -254,7 +263,7 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
254 | { | 263 | { |
255 | int include_record = GNUNET_YES; | 264 | int include_record = GNUNET_YES; |
256 | /* Shadow record, figure out if we have a not expired active record */ | 265 | /* Shadow record, figure out if we have a not expired active record */ |
257 | for (k=0;k<rd_count;k++) | 266 | for (unsigned int k=0;k<rd_count;k++) |
258 | { | 267 | { |
259 | if (k == i) | 268 | if (k == i) |
260 | continue; | 269 | continue; |
@@ -283,7 +292,9 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
283 | } | 292 | } |
284 | rd_count = j; | 293 | rd_count = j; |
285 | if (NULL != proc) | 294 | if (NULL != proc) |
286 | proc (proc_cls, rd_count, (0 != rd_count) ? rd : NULL); | 295 | proc (proc_cls, |
296 | rd_count, | ||
297 | (0 != rd_count) ? rd : NULL); | ||
287 | } | 298 | } |
288 | } | 299 | } |
289 | return GNUNET_OK; | 300 | return GNUNET_OK; |
@@ -323,8 +334,13 @@ GNUNET_GNSRECORD_query_from_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKe | |||
323 | { | 334 | { |
324 | struct GNUNET_CRYPTO_EcdsaPublicKey pd; | 335 | struct GNUNET_CRYPTO_EcdsaPublicKey pd; |
325 | 336 | ||
326 | GNUNET_CRYPTO_ecdsa_public_key_derive (pub, label, "gns", &pd); | 337 | GNUNET_CRYPTO_ecdsa_public_key_derive (pub, |
327 | GNUNET_CRYPTO_hash (&pd, sizeof (pd), query); | 338 | label, |
339 | "gns", | ||
340 | &pd); | ||
341 | GNUNET_CRYPTO_hash (&pd, | ||
342 | sizeof (pd), | ||
343 | query); | ||
328 | } | 344 | } |
329 | 345 | ||
330 | 346 | ||
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index d03b4db3b..f07bd3ef3 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -342,9 +342,10 @@ GNUNET_NETWORK_STRUCT_END | |||
342 | * @param rd_count number of entries in @a rd array | 342 | * @param rd_count number of entries in @a rd array |
343 | * @param rd array of records with data to store | 343 | * @param rd array of records with data to store |
344 | */ | 344 | */ |
345 | typedef void (*GNUNET_GNSRECORD_RecordCallback) (void *cls, | 345 | typedef void |
346 | unsigned int rd_count, | 346 | (*GNUNET_GNSRECORD_RecordCallback) (void *cls, |
347 | const struct GNUNET_GNSRECORD_Data *rd); | 347 | unsigned int rd_count, |
348 | const struct GNUNET_GNSRECORD_Data *rd); | ||
348 | 349 | ||
349 | 350 | ||
350 | 351 | ||
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 3ba4f9ec3..cc41f071d 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "gnunet_namecache_service.h" | 31 | #include "gnunet_namecache_service.h" |
32 | #include "gnunet_namestore_service.h" | 32 | #include "gnunet_namestore_service.h" |
33 | #include "gnunet_namestore_plugin.h" | 33 | #include "gnunet_namestore_plugin.h" |
34 | #include "gnunet_statistics_service.h" | ||
34 | #include "gnunet_signatures.h" | 35 | #include "gnunet_signatures.h" |
35 | #include "namestore.h" | 36 | #include "namestore.h" |
36 | 37 | ||
@@ -206,6 +207,11 @@ static const struct GNUNET_CRYPTO_EcdsaPrivateKey zero; | |||
206 | static const struct GNUNET_CONFIGURATION_Handle *GSN_cfg; | 207 | static const struct GNUNET_CONFIGURATION_Handle *GSN_cfg; |
207 | 208 | ||
208 | /** | 209 | /** |
210 | * Handle to the statistics service | ||
211 | */ | ||
212 | static struct GNUNET_STATISTICS_Handle *statistics; | ||
213 | |||
214 | /** | ||
209 | * Namecache handle. | 215 | * Namecache handle. |
210 | */ | 216 | */ |
211 | static struct GNUNET_NAMECACHE_Handle *namecache; | 217 | static struct GNUNET_NAMECACHE_Handle *namecache; |
@@ -280,6 +286,12 @@ cleanup_task (void *cls) | |||
280 | GNUNET_notification_context_destroy (monitor_nc); | 286 | GNUNET_notification_context_destroy (monitor_nc); |
281 | monitor_nc = NULL; | 287 | monitor_nc = NULL; |
282 | } | 288 | } |
289 | if (NULL != statistics) | ||
290 | { | ||
291 | GNUNET_STATISTICS_destroy (statistics, | ||
292 | GNUNET_NO); | ||
293 | statistics = NULL; | ||
294 | } | ||
283 | } | 295 | } |
284 | 296 | ||
285 | 297 | ||
@@ -582,6 +594,10 @@ send_lookup_response (struct NamestoreClient *nc, | |||
582 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
583 | "Sending RECORD_RESULT message with %u records\n", | 595 | "Sending RECORD_RESULT message with %u records\n", |
584 | res_count); | 596 | res_count); |
597 | GNUNET_STATISTICS_update (statistics, | ||
598 | "Record sets sent to clients", | ||
599 | 1, | ||
600 | GNUNET_NO); | ||
585 | GNUNET_MQ_send (nc->mq, | 601 | GNUNET_MQ_send (nc->mq, |
586 | env); | 602 | env); |
587 | if (rd != res) | 603 | if (rd != res) |
@@ -707,6 +723,10 @@ refresh_block (struct NamestoreClient *nc, | |||
707 | name, | 723 | name, |
708 | res_count, | 724 | res_count, |
709 | GNUNET_GNSRECORD_z2s (&pkey)); | 725 | GNUNET_GNSRECORD_z2s (&pkey)); |
726 | GNUNET_STATISTICS_update (statistics, | ||
727 | "Namecache updates pushed", | ||
728 | 1, | ||
729 | GNUNET_NO); | ||
710 | cop = GNUNET_new (struct CacheOperation); | 730 | cop = GNUNET_new (struct CacheOperation); |
711 | cop->nc = nc; | 731 | cop->nc = nc; |
712 | cop->rid = rid; | 732 | cop->rid = rid; |
@@ -774,7 +794,8 @@ lookup_it (void *cls, | |||
774 | unsigned int rdc_res; | 794 | unsigned int rdc_res; |
775 | 795 | ||
776 | (void) private_key; | 796 | (void) private_key; |
777 | if (0 == strcmp (label, rlc->label)) | 797 | if (0 == strcmp (label, |
798 | rlc->label)) | ||
778 | { | 799 | { |
779 | rlc->found = GNUNET_YES; | 800 | rlc->found = GNUNET_YES; |
780 | if (0 != rd_count) | 801 | if (0 != rd_count) |
@@ -1332,7 +1353,8 @@ zone_iterate_proc (void *cls, | |||
1332 | struct ZoneIterationProcResult *proc = cls; | 1353 | struct ZoneIterationProcResult *proc = cls; |
1333 | int do_refresh_block; | 1354 | int do_refresh_block; |
1334 | 1355 | ||
1335 | if ((NULL == zone_key) && (NULL == name)) | 1356 | if ( (NULL == zone_key) && |
1357 | (NULL == name) ) | ||
1336 | { | 1358 | { |
1337 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1359 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1338 | "Iteration done\n"); | 1360 | "Iteration done\n"); |
@@ -1391,11 +1413,14 @@ run_zone_iteration_round (struct ZoneIteration *zi) | |||
1391 | { | 1413 | { |
1392 | if (GNUNET_SYSERR == | 1414 | if (GNUNET_SYSERR == |
1393 | (ret = GSN_database->iterate_records (GSN_database->cls, | 1415 | (ret = GSN_database->iterate_records (GSN_database->cls, |
1394 | (0 == memcmp (&zi->zone, &zero, sizeof (zero))) | 1416 | (0 == memcmp (&zi->zone, |
1417 | &zero, | ||
1418 | sizeof (zero))) | ||
1395 | ? NULL | 1419 | ? NULL |
1396 | : &zi->zone, | 1420 | : &zi->zone, |
1397 | zi->offset, | 1421 | zi->offset, |
1398 | &zone_iterate_proc, &proc))) | 1422 | &zone_iterate_proc, |
1423 | &proc))) | ||
1399 | { | 1424 | { |
1400 | GNUNET_break (0); | 1425 | GNUNET_break (0); |
1401 | break; | 1426 | break; |
@@ -1503,6 +1528,10 @@ handle_iteration_next (void *cls, | |||
1503 | 1528 | ||
1504 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1529 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1505 | "Received ZONE_ITERATION_NEXT message\n"); | 1530 | "Received ZONE_ITERATION_NEXT message\n"); |
1531 | GNUNET_STATISTICS_update (statistics, | ||
1532 | "Iteration NEXT messages received", | ||
1533 | 1, | ||
1534 | GNUNET_NO); | ||
1506 | rid = ntohl (zis_msg->gns_header.r_id); | 1535 | rid = ntohl (zis_msg->gns_header.r_id); |
1507 | for (zi = nc->op_head; NULL != zi; zi = zi->next) | 1536 | for (zi = nc->op_head; NULL != zi; zi = zi->next) |
1508 | if (zi->request_id == rid) | 1537 | if (zi->request_id == rid) |
@@ -1569,6 +1598,10 @@ monitor_iterate_cb (void *cls, | |||
1569 | monitor_sync (zm); | 1598 | monitor_sync (zm); |
1570 | return; | 1599 | return; |
1571 | } | 1600 | } |
1601 | GNUNET_STATISTICS_update (statistics, | ||
1602 | "Monitor notifications sent", | ||
1603 | 1, | ||
1604 | GNUNET_NO); | ||
1572 | send_lookup_response (zm->nc, | 1605 | send_lookup_response (zm->nc, |
1573 | 0, | 1606 | 0, |
1574 | zone_key, | 1607 | zone_key, |
@@ -1684,6 +1717,8 @@ run (void *cls, | |||
1684 | GSN_database = GNUNET_PLUGIN_load (db_lib_name, | 1717 | GSN_database = GNUNET_PLUGIN_load (db_lib_name, |
1685 | (void *) GSN_cfg); | 1718 | (void *) GSN_cfg); |
1686 | GNUNET_free (database); | 1719 | GNUNET_free (database); |
1720 | statistics = GNUNET_STATISTICS_create ("namestore", | ||
1721 | cfg); | ||
1687 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, | 1722 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, |
1688 | NULL); | 1723 | NULL); |
1689 | if (NULL == GSN_database) | 1724 | if (NULL == GSN_database) |
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c index b3a2cb8b3..bf11f7d20 100644 --- a/src/zonemaster/gnunet-service-zonemaster.c +++ b/src/zonemaster/gnunet-service-zonemaster.c | |||
@@ -336,11 +336,10 @@ convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd, | |||
336 | { | 336 | { |
337 | struct GNUNET_TIME_Absolute now; | 337 | struct GNUNET_TIME_Absolute now; |
338 | unsigned int rd_public_count; | 338 | unsigned int rd_public_count; |
339 | unsigned int i; | ||
340 | 339 | ||
341 | rd_public_count = 0; | 340 | rd_public_count = 0; |
342 | now = GNUNET_TIME_absolute_get (); | 341 | now = GNUNET_TIME_absolute_get (); |
343 | for (i=0;i<rd_count;i++) | 342 | for (unsigned int i=0;i<rd_count;i++) |
344 | if (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)) | 343 | if (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)) |
345 | { | 344 | { |
346 | rd_public[rd_public_count] = rd[i]; | 345 | rd_public[rd_public_count] = rd[i]; |
@@ -401,6 +400,10 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
401 | GNUNET_GNSRECORD_query_from_private_key (key, | 400 | GNUNET_GNSRECORD_query_from_private_key (key, |
402 | label, | 401 | label, |
403 | &query); | 402 | &query); |
403 | GNUNET_STATISTICS_update (statistics, | ||
404 | "DHT put operations initiated", | ||
405 | 1, | ||
406 | GNUNET_NO); | ||
404 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
405 | "Storing %u record(s) for label `%s' in DHT with expiration `%s' under key %s\n", | 408 | "Storing %u record(s) for label `%s' in DHT with expiration `%s' under key %s\n", |
406 | rd_public_count, | 409 | rd_public_count, |
@@ -424,10 +427,13 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
424 | 427 | ||
425 | /** | 428 | /** |
426 | * We encountered an error in our zone iteration. | 429 | * We encountered an error in our zone iteration. |
430 | * | ||
431 | * @param cls NULL | ||
427 | */ | 432 | */ |
428 | static void | 433 | static void |
429 | zone_iteration_error (void *cls) | 434 | zone_iteration_error (void *cls) |
430 | { | 435 | { |
436 | (void) cls; | ||
431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 437 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
432 | "Got disconnected from namestore database, retrying.\n"); | 438 | "Got disconnected from namestore database, retrying.\n"); |
433 | namestore_iter = NULL; | 439 | namestore_iter = NULL; |
@@ -451,10 +457,13 @@ zone_iteration_error (void *cls) | |||
451 | 457 | ||
452 | /** | 458 | /** |
453 | * Zone iteration is completed. | 459 | * Zone iteration is completed. |
460 | * | ||
461 | * @param cls NULL | ||
454 | */ | 462 | */ |
455 | static void | 463 | static void |
456 | zone_iteration_finished (void *cls) | 464 | zone_iteration_finished (void *cls) |
457 | { | 465 | { |
466 | (void) cls; | ||
458 | /* we're done with one iteration, calculate when to do the next one */ | 467 | /* we're done with one iteration, calculate when to do the next one */ |
459 | namestore_iter = NULL; | 468 | namestore_iter = NULL; |
460 | last_num_public_records = num_public_records; | 469 | last_num_public_records = num_public_records; |
@@ -533,10 +542,10 @@ put_gns_record (void *cls, | |||
533 | struct GNUNET_GNSRECORD_Data rd_public[rd_count]; | 542 | struct GNUNET_GNSRECORD_Data rd_public[rd_count]; |
534 | unsigned int rd_public_count; | 543 | unsigned int rd_public_count; |
535 | 544 | ||
545 | (void) cls; | ||
536 | rd_public_count = convert_records_for_export (rd, | 546 | rd_public_count = convert_records_for_export (rd, |
537 | rd_count, | 547 | rd_count, |
538 | rd_public); | 548 | rd_public); |
539 | |||
540 | if (0 == rd_public_count) | 549 | if (0 == rd_public_count) |
541 | { | 550 | { |
542 | GNUNET_assert (NULL == zone_publish_task); | 551 | GNUNET_assert (NULL == zone_publish_task); |
@@ -571,7 +580,10 @@ static void | |||
571 | publish_zone_dht_start (void *cls) | 580 | publish_zone_dht_start (void *cls) |
572 | { | 581 | { |
573 | zone_publish_task = NULL; | 582 | zone_publish_task = NULL; |
574 | 583 | GNUNET_STATISTICS_update (statistics, | |
584 | "Full zone iterations launched", | ||
585 | 1, | ||
586 | GNUNET_NO); | ||
575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
576 | "Starting DHT zone update!\n"); | 588 | "Starting DHT zone update!\n"); |
577 | /* start counting again */ | 589 | /* start counting again */ |
@@ -610,6 +622,10 @@ handle_monitor_event (void *cls, | |||
610 | unsigned int rd_public_count; | 622 | unsigned int rd_public_count; |
611 | struct MonitorActivity *ma; | 623 | struct MonitorActivity *ma; |
612 | 624 | ||
625 | GNUNET_STATISTICS_update (statistics, | ||
626 | "Namestore monitor events received", | ||
627 | 1, | ||
628 | GNUNET_NO); | ||
613 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 629 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
614 | "Received %u records for label `%s' via namestore monitor\n", | 630 | "Received %u records for label `%s' via namestore monitor\n", |
615 | rd_count, | 631 | rd_count, |
@@ -648,22 +664,28 @@ handle_monitor_event (void *cls, | |||
648 | static void | 664 | static void |
649 | monitor_sync_event (void *cls) | 665 | monitor_sync_event (void *cls) |
650 | { | 666 | { |
667 | (void) cls; | ||
651 | if ( (NULL == zone_publish_task) && | 668 | if ( (NULL == zone_publish_task) && |
652 | (NULL == namestore_iter) ) | 669 | (NULL == namestore_iter) ) |
653 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | 670 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, |
654 | NULL); | 671 | NULL); |
655 | } | 672 | } |
656 | 673 | ||
657 | 674 | ||
658 | /** | 675 | /** |
659 | * The zone monitor is now in SYNC with the current state of the | 676 | * The zone monitor encountered an IPC error trying to to get in |
660 | * name store. Start to perform periodic iterations. | 677 | * sync. Restart from the beginning. |
661 | * | 678 | * |
662 | * @param cls NULL | 679 | * @param cls NULL |
663 | */ | 680 | */ |
664 | static void | 681 | static void |
665 | handle_monitor_error (void *cls) | 682 | handle_monitor_error (void *cls) |
666 | { | 683 | { |
684 | (void) cls; | ||
685 | GNUNET_STATISTICS_update (statistics, | ||
686 | "Namestore monitor errors encountered", | ||
687 | 1, | ||
688 | GNUNET_NO); | ||
667 | if (NULL != zone_publish_task) | 689 | if (NULL != zone_publish_task) |
668 | { | 690 | { |
669 | GNUNET_SCHEDULER_cancel (zone_publish_task); | 691 | GNUNET_SCHEDULER_cancel (zone_publish_task); |
@@ -698,6 +720,7 @@ run (void *cls, | |||
698 | { | 720 | { |
699 | unsigned long long max_parallel_bg_queries = 128; | 721 | unsigned long long max_parallel_bg_queries = 128; |
700 | 722 | ||
723 | (void) cls; | ||
701 | min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; | 724 | min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; |
702 | namestore_handle = GNUNET_NAMESTORE_connect (c); | 725 | namestore_handle = GNUNET_NAMESTORE_connect (c); |
703 | if (NULL == namestore_handle) | 726 | if (NULL == namestore_handle) |
@@ -733,7 +756,7 @@ run (void *cls, | |||
733 | max_parallel_bg_queries); | 756 | max_parallel_bg_queries); |
734 | } | 757 | } |
735 | if (0 == max_parallel_bg_queries) | 758 | if (0 == max_parallel_bg_queries) |
736 | max_parallel_bg_queries = 1; | 759 | max_parallel_bg_queries = 1; |
737 | dht_handle = GNUNET_DHT_connect (c, | 760 | dht_handle = GNUNET_DHT_connect (c, |
738 | (unsigned int) max_parallel_bg_queries); | 761 | (unsigned int) max_parallel_bg_queries); |
739 | if (NULL == dht_handle) | 762 | if (NULL == dht_handle) |
@@ -746,7 +769,8 @@ run (void *cls, | |||
746 | 769 | ||
747 | /* Schedule periodic put for our records. */ | 770 | /* Schedule periodic put for our records. */ |
748 | first_zone_iteration = GNUNET_YES;\ | 771 | first_zone_iteration = GNUNET_YES;\ |
749 | statistics = GNUNET_STATISTICS_create ("zonemaster", c); | 772 | statistics = GNUNET_STATISTICS_create ("zonemaster", |
773 | c); | ||
750 | zmon = GNUNET_NAMESTORE_zone_monitor_start (c, | 774 | zmon = GNUNET_NAMESTORE_zone_monitor_start (c, |
751 | NULL, | 775 | NULL, |
752 | GNUNET_NO, | 776 | GNUNET_NO, |