diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-09-27 19:11:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-09-27 19:11:47 +0000 |
commit | 1b1df3463080c4f269394dac31854a024e8c2ec4 (patch) | |
tree | 38dc6bd90c5ba17c3b84d23fc9b3cc510876f5e2 /src/dht | |
parent | 31ee5f418d7ae0d1ede1f24397769868e4341e28 (diff) | |
download | gnunet-1b1df3463080c4f269394dac31854a024e8c2ec4.tar.gz gnunet-1b1df3463080c4f269394dac31854a024e8c2ec4.zip |
adding some stats
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/Makefile.am | 2 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht-new.c | 1 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht.h | 3 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_clients.c | 16 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.c | 18 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_hello.c | 3 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 42 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_nse.c | 3 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_routing.c | 22 | ||||
-rw-r--r-- | src/dht/test_dht_api.c | 219 | ||||
-rw-r--r-- | src/dht/test_dht_api_peer1.conf | 1 |
11 files changed, 118 insertions, 212 deletions
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am index 5cad82062..161a498ec 100644 --- a/src/dht/Makefile.am +++ b/src/dht/Makefile.am | |||
@@ -205,7 +205,7 @@ test_dht_api_SOURCES = \ | |||
205 | test_dht_api_LDADD = \ | 205 | test_dht_api_LDADD = \ |
206 | $(top_builddir)/src/util/libgnunetutil.la \ | 206 | $(top_builddir)/src/util/libgnunetutil.la \ |
207 | $(top_builddir)/src/hello/libgnunethello.la \ | 207 | $(top_builddir)/src/hello/libgnunethello.la \ |
208 | $(top_builddir)/src/dht/libgnunetdht.la | 208 | $(top_builddir)/src/dht/libgnunetdhtnew.la |
209 | test_dht_api_DEPENDENCIES = \ | 209 | test_dht_api_DEPENDENCIES = \ |
210 | libgnunetdht.la | 210 | libgnunetdht.la |
211 | 211 | ||
diff --git a/src/dht/gnunet-service-dht-new.c b/src/dht/gnunet-service-dht-new.c index 45c235d40..3e0f3c8d9 100644 --- a/src/dht/gnunet-service-dht-new.c +++ b/src/dht/gnunet-service-dht-new.c | |||
@@ -67,7 +67,6 @@ struct GNUNET_MessageHeader *GDS_my_hello; | |||
67 | struct GNUNET_TRANSPORT_Handle *GDS_transport_handle; | 67 | struct GNUNET_TRANSPORT_Handle *GDS_transport_handle; |
68 | 68 | ||
69 | 69 | ||
70 | |||
71 | /** | 70 | /** |
72 | * Handle to get our current HELLO. | 71 | * Handle to get our current HELLO. |
73 | */ | 72 | */ |
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h index 3a716acde..7cacdba7a 100644 --- a/src/dht/gnunet-service-dht.h +++ b/src/dht/gnunet-service-dht.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define GNUNET_SERVICE_DHT_H | 27 | #define GNUNET_SERVICE_DHT_H |
28 | 28 | ||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_statistics_service.h" | ||
31 | #include "gnunet_transport_service.h" | ||
30 | 32 | ||
31 | /** | 33 | /** |
32 | * Configuration we use. | 34 | * Configuration we use. |
@@ -39,7 +41,6 @@ extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg; | |||
39 | */ | 41 | */ |
40 | extern struct GNUNET_BLOCK_Context *GDS_block_context; | 42 | extern struct GNUNET_BLOCK_Context *GDS_block_context; |
41 | 43 | ||
42 | |||
43 | /** | 44 | /** |
44 | * Handle for the statistics service. | 45 | * Handle for the statistics service. |
45 | */ | 46 | */ |
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index bb57d83ef..fcfdfc7fd 100644 --- a/src/dht/gnunet-service-dht_clients.c +++ b/src/dht/gnunet-service-dht_clients.c | |||
@@ -304,6 +304,9 @@ transmit_request (struct ClientQueryRecord *cqr) | |||
304 | int32_t reply_bf_mutator; | 304 | int32_t reply_bf_mutator; |
305 | struct GNUNET_CONTAINER_BloomFilter *reply_bf; | 305 | struct GNUNET_CONTAINER_BloomFilter *reply_bf; |
306 | 306 | ||
307 | GNUNET_STATISTICS_update (GDS_stats, | ||
308 | gettext_noop ("# GET requests from clients injected into P2P network"), 1, | ||
309 | GNUNET_NO); | ||
307 | reply_bf_mutator = (int32_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 310 | reply_bf_mutator = (int32_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
308 | UINT32_MAX); | 311 | UINT32_MAX); |
309 | reply_bf = GNUNET_BLOCK_construct_bloomfilter (reply_bf_mutator, | 312 | reply_bf = GNUNET_BLOCK_construct_bloomfilter (reply_bf_mutator, |
@@ -385,6 +388,9 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client, | |||
385 | GNUNET_break (0); | 388 | GNUNET_break (0); |
386 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 389 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
387 | } | 390 | } |
391 | GNUNET_STATISTICS_update (GDS_stats, | ||
392 | gettext_noop ("# PUT requests received from clients"), 1, | ||
393 | GNUNET_NO); | ||
388 | dht_msg = (const struct GNUNET_DHT_ClientPutMessage *) message; | 394 | dht_msg = (const struct GNUNET_DHT_ClientPutMessage *) message; |
389 | /* give to local clients */ | 395 | /* give to local clients */ |
390 | GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration), | 396 | GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration), |
@@ -445,7 +451,9 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
445 | xquery_size = size - sizeof (struct GNUNET_DHT_ClientGetMessage); | 451 | xquery_size = size - sizeof (struct GNUNET_DHT_ClientGetMessage); |
446 | get = (const struct GNUNET_DHT_ClientGetMessage *) message; | 452 | get = (const struct GNUNET_DHT_ClientGetMessage *) message; |
447 | xquery = (const char*) &get[1]; | 453 | xquery = (const char*) &get[1]; |
448 | 454 | GNUNET_STATISTICS_update (GDS_stats, | |
455 | gettext_noop ("# GET requests received from clients"), 1, | ||
456 | GNUNET_NO); | ||
449 | 457 | ||
450 | cqr = GNUNET_malloc (sizeof (struct ClientQueryRecord) + xquery_size); | 458 | cqr = GNUNET_malloc (sizeof (struct ClientQueryRecord) + xquery_size); |
451 | cqr->key = get->key; | 459 | cqr->key = get->key; |
@@ -531,6 +539,9 @@ handle_dht_local_get_stop (void *cls, struct GNUNET_SERVER_Client *client, | |||
531 | (const struct GNUNET_DHT_ClientGetStopMessage *) message; | 539 | (const struct GNUNET_DHT_ClientGetStopMessage *) message; |
532 | struct RemoveByUniqueIdContext ctx; | 540 | struct RemoveByUniqueIdContext ctx; |
533 | 541 | ||
542 | GNUNET_STATISTICS_update (GDS_stats, | ||
543 | gettext_noop ("# GET STOP requests received from clients"), 1, | ||
544 | GNUNET_NO); | ||
534 | ctx.client = find_active_client (client); | 545 | ctx.client = find_active_client (client); |
535 | ctx.unique_id = dht_stop_msg->unique_id; | 546 | ctx.unique_id = dht_stop_msg->unique_id; |
536 | GNUNET_CONTAINER_multihashmap_get_multiple (forward_map, | 547 | GNUNET_CONTAINER_multihashmap_get_multiple (forward_map, |
@@ -748,6 +759,9 @@ forward_reply (void *cls, const GNUNET_HashCode * key, void *value) | |||
748 | sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size)); | 759 | sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size)); |
749 | pm->next = pm->prev = NULL; | 760 | pm->next = pm->prev = NULL; |
750 | } | 761 | } |
762 | GNUNET_STATISTICS_update (GDS_stats, | ||
763 | gettext_noop ("# RESULTS queued for clients"), 1, | ||
764 | GNUNET_NO); | ||
751 | reply = (struct GNUNET_DHT_ClientResultMessage*) &pm[1]; | 765 | reply = (struct GNUNET_DHT_ClientResultMessage*) &pm[1]; |
752 | reply->unique_id = record->unique_id; | 766 | reply->unique_id = record->unique_id; |
753 | add_pending_message (record->client, pm); | 767 | add_pending_message (record->client, pm); |
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 723dd02ca..1ba176e6e 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c | |||
@@ -99,6 +99,9 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | /* Put size is actual data size plus struct overhead plus path length (if any) */ | 101 | /* Put size is actual data size plus struct overhead plus path length (if any) */ |
102 | GNUNET_STATISTICS_update (GDS_stats, | ||
103 | gettext_noop ("# ITEMS stored in datacache"), 1, | ||
104 | GNUNET_NO); | ||
102 | pe = (struct DHTPutEntry *) buf; | 105 | pe = (struct DHTPutEntry *) buf; |
103 | pe->data_size = htons (data_size); | 106 | pe->data_size = htons (data_size); |
104 | pe->path_length = htons ((uint16_t) put_path_length); | 107 | pe->path_length = htons ((uint16_t) put_path_length); |
@@ -202,6 +205,9 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
202 | case GNUNET_BLOCK_EVALUATION_OK_LAST: | 205 | case GNUNET_BLOCK_EVALUATION_OK_LAST: |
203 | case GNUNET_BLOCK_EVALUATION_OK_MORE: | 206 | case GNUNET_BLOCK_EVALUATION_OK_MORE: |
204 | /* forward to local clients */ | 207 | /* forward to local clients */ |
208 | GNUNET_STATISTICS_update (GDS_stats, | ||
209 | gettext_noop ("# Good RESULTS found in datacache"), 1, | ||
210 | GNUNET_NO); | ||
205 | GDS_CLIENTS_handle_reply (exp, | 211 | GDS_CLIENTS_handle_reply (exp, |
206 | key, | 212 | key, |
207 | 0, NULL, | 213 | 0, NULL, |
@@ -213,8 +219,14 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
213 | 0, NULL, rdata, rdata_size); | 219 | 0, NULL, rdata, rdata_size); |
214 | break; | 220 | break; |
215 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | 221 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: |
222 | GNUNET_STATISTICS_update (GDS_stats, | ||
223 | gettext_noop ("# Duplicate RESULTS found in datacache"), 1, | ||
224 | GNUNET_NO); | ||
216 | break; | 225 | break; |
217 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: | 226 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: |
227 | GNUNET_STATISTICS_update (GDS_stats, | ||
228 | gettext_noop ("# Invalid RESULTS found in datacache"), 1, | ||
229 | GNUNET_NO); | ||
218 | break; | 230 | break; |
219 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: | 231 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: |
220 | GNUNET_break (0); | 232 | GNUNET_break (0); |
@@ -223,6 +235,9 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
223 | GNUNET_break_op (0); | 235 | GNUNET_break_op (0); |
224 | return GNUNET_SYSERR; | 236 | return GNUNET_SYSERR; |
225 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: | 237 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: |
238 | GNUNET_STATISTICS_update (GDS_stats, | ||
239 | gettext_noop ("# Unsupported RESULTS found in datacache"), 1, | ||
240 | GNUNET_NO); | ||
226 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 241 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
227 | "Unsupported block type (%u) in local response!\n", | 242 | "Unsupported block type (%u) in local response!\n", |
228 | type); | 243 | type); |
@@ -255,6 +270,9 @@ GDS_DATACACHE_handle_get (const GNUNET_HashCode *key, | |||
255 | 270 | ||
256 | if (datacache == NULL) | 271 | if (datacache == NULL) |
257 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 272 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
273 | GNUNET_STATISTICS_update (GDS_stats, | ||
274 | gettext_noop ("# GET requests given to datacache"), 1, | ||
275 | GNUNET_NO); | ||
258 | ctx.eval = GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 276 | ctx.eval = GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
259 | ctx.key = *key; | 277 | ctx.key = *key; |
260 | ctx.xquery = xquery; | 278 | ctx.xquery = xquery; |
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c index 2ee60c91f..db10bb68c 100644 --- a/src/dht/gnunet-service-dht_hello.c +++ b/src/dht/gnunet-service-dht_hello.c | |||
@@ -80,6 +80,9 @@ process_hello (void *cls, | |||
80 | ex = GNUNET_HELLO_get_last_expiration (hello); | 80 | ex = GNUNET_HELLO_get_last_expiration (hello); |
81 | if (GNUNET_TIME_absolute_get_remaining (ex).rel_value == 0) | 81 | if (GNUNET_TIME_absolute_get_remaining (ex).rel_value == 0) |
82 | return; | 82 | return; |
83 | GNUNET_STATISTICS_update (GDS_stats, | ||
84 | gettext_noop ("# HELLOs obtained from peerinfo"), 1, | ||
85 | GNUNET_NO); | ||
83 | hm = GNUNET_CONTAINER_multihashmap_get (peer_to_hello, | 86 | hm = GNUNET_CONTAINER_multihashmap_get (peer_to_hello, |
84 | &peer->hashPubKey); | 87 | &peer->hashPubKey); |
85 | GNUNET_free_non_null (hm); | 88 | GNUNET_free_non_null (hm); |
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 96a43c23f..91caed95c 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -515,6 +515,9 @@ update_core_preference (void *cls, | |||
515 | &update_core_preference, peer); | 515 | &update_core_preference, peer); |
516 | return; | 516 | return; |
517 | } | 517 | } |
518 | GNUNET_STATISTICS_update (GDS_stats, | ||
519 | gettext_noop ("# Preference updates given to core"), 1, | ||
520 | GNUNET_NO); | ||
518 | peer->info_ctx = | 521 | peer->info_ctx = |
519 | GNUNET_CORE_peer_change_preference (coreAPI, &peer->id, | 522 | GNUNET_CORE_peer_change_preference (coreAPI, &peer->id, |
520 | GNUNET_TIME_UNIT_FOREVER_REL, | 523 | GNUNET_TIME_UNIT_FOREVER_REL, |
@@ -594,6 +597,9 @@ send_find_peer_message (void *cls, | |||
594 | GNUNET_CONTAINER_multihashmap_iterate (all_known_peers, | 597 | GNUNET_CONTAINER_multihashmap_iterate (all_known_peers, |
595 | &add_known_to_bloom, | 598 | &add_known_to_bloom, |
596 | &bcc); | 599 | &bcc); |
600 | GNUNET_STATISTICS_update (GDS_stats, | ||
601 | gettext_noop ("# FIND PEER messages initiated"), 1, | ||
602 | GNUNET_NO); | ||
597 | // FIXME: pass priority!? | 603 | // FIXME: pass priority!? |
598 | GDS_NEIGHBOURS_handle_get (GNUNET_BLOCK_TYPE_DHT_HELLO, | 604 | GDS_NEIGHBOURS_handle_get (GNUNET_BLOCK_TYPE_DHT_HELLO, |
599 | GNUNET_DHT_RO_FIND_PEER, | 605 | GNUNET_DHT_RO_FIND_PEER, |
@@ -639,6 +645,9 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
639 | GNUNET_break (0); | 645 | GNUNET_break (0); |
640 | return; | 646 | return; |
641 | } | 647 | } |
648 | GNUNET_STATISTICS_update (GDS_stats, | ||
649 | gettext_noop ("# Peers connected"), 1, | ||
650 | GNUNET_NO); | ||
642 | peer_bucket = find_bucket (&peer->hashPubKey); | 651 | peer_bucket = find_bucket (&peer->hashPubKey); |
643 | GNUNET_assert ( (peer_bucket >= 0) && (peer_bucket < MAX_BUCKETS) ); | 652 | GNUNET_assert ( (peer_bucket >= 0) && (peer_bucket < MAX_BUCKETS) ); |
644 | ret = GNUNET_malloc (sizeof (struct PeerInfo)); | 653 | ret = GNUNET_malloc (sizeof (struct PeerInfo)); |
@@ -692,6 +701,9 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
692 | GNUNET_break (0); | 701 | GNUNET_break (0); |
693 | return; | 702 | return; |
694 | } | 703 | } |
704 | GNUNET_STATISTICS_update (GDS_stats, | ||
705 | gettext_noop ("# Peers connected"), -1, | ||
706 | GNUNET_NO); | ||
695 | GNUNET_assert (GNUNET_YES == | 707 | GNUNET_assert (GNUNET_YES == |
696 | GNUNET_CONTAINER_multihashmap_remove (all_known_peers, | 708 | GNUNET_CONTAINER_multihashmap_remove (all_known_peers, |
697 | &peer->hashPubKey, | 709 | &peer->hashPubKey, |
@@ -759,6 +771,9 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
759 | while ( (NULL != (pending = peer->head)) && | 771 | while ( (NULL != (pending = peer->head)) && |
760 | (size - off >= (msize = ntohs (pending->msg->size))) ) | 772 | (size - off >= (msize = ntohs (pending->msg->size))) ) |
761 | { | 773 | { |
774 | GNUNET_STATISTICS_update (GDS_stats, | ||
775 | gettext_noop ("# Bytes transmitted to other peers"), msize, | ||
776 | GNUNET_NO); | ||
762 | memcpy (&cbuf[off], pending->msg, msize); | 777 | memcpy (&cbuf[off], pending->msg, msize); |
763 | off += msize; | 778 | off += msize; |
764 | peer->pending_count--; | 779 | peer->pending_count--; |
@@ -1148,6 +1163,9 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type, | |||
1148 | struct PeerPutMessage *ppm; | 1163 | struct PeerPutMessage *ppm; |
1149 | struct GNUNET_PeerIdentity *pp; | 1164 | struct GNUNET_PeerIdentity *pp; |
1150 | 1165 | ||
1166 | GNUNET_STATISTICS_update (GDS_stats, | ||
1167 | gettext_noop ("# PUT requests routed"), 1, | ||
1168 | GNUNET_NO); | ||
1151 | target_count = get_target_peers (key, bf, hop_count, | 1169 | target_count = get_target_peers (key, bf, hop_count, |
1152 | desired_replication_level, | 1170 | desired_replication_level, |
1153 | &targets); | 1171 | &targets); |
@@ -1164,6 +1182,9 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type, | |||
1164 | GNUNET_break (0); | 1182 | GNUNET_break (0); |
1165 | return; | 1183 | return; |
1166 | } | 1184 | } |
1185 | GNUNET_STATISTICS_update (GDS_stats, | ||
1186 | gettext_noop ("# Peers selected as targets for PUT requests"), target_count, | ||
1187 | GNUNET_NO); | ||
1167 | for (i=0;i<target_count;i++) | 1188 | for (i=0;i<target_count;i++) |
1168 | { | 1189 | { |
1169 | target = targets[i]; | 1190 | target = targets[i]; |
@@ -1237,6 +1258,9 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, | |||
1237 | char *xq; | 1258 | char *xq; |
1238 | size_t reply_bf_size; | 1259 | size_t reply_bf_size; |
1239 | 1260 | ||
1261 | GNUNET_STATISTICS_update (GDS_stats, | ||
1262 | gettext_noop ("# GET requests routed"), 1, | ||
1263 | GNUNET_NO); | ||
1240 | target_count = get_target_peers (key, peer_bf, hop_count, | 1264 | target_count = get_target_peers (key, peer_bf, hop_count, |
1241 | desired_replication_level, | 1265 | desired_replication_level, |
1242 | &targets); | 1266 | &targets); |
@@ -1249,6 +1273,9 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, | |||
1249 | GNUNET_break (0); | 1273 | GNUNET_break (0); |
1250 | return; | 1274 | return; |
1251 | } | 1275 | } |
1276 | GNUNET_STATISTICS_update (GDS_stats, | ||
1277 | gettext_noop ("# Peers selected as targets for GET requests"), target_count, | ||
1278 | GNUNET_NO); | ||
1252 | /* forward request */ | 1279 | /* forward request */ |
1253 | for (i=0;i<target_count;i++) | 1280 | for (i=0;i<target_count;i++) |
1254 | { | 1281 | { |
@@ -1338,6 +1365,9 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, | |||
1338 | /* peer disconnected in the meantime, drop reply */ | 1365 | /* peer disconnected in the meantime, drop reply */ |
1339 | return; | 1366 | return; |
1340 | } | 1367 | } |
1368 | GNUNET_STATISTICS_update (GDS_stats, | ||
1369 | gettext_noop ("# REPLIES routed"), 1, | ||
1370 | GNUNET_NO); | ||
1341 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); | 1371 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); |
1342 | pending->importance = 0; /* FIXME */ | 1372 | pending->importance = 0; /* FIXME */ |
1343 | pending->timeout = expiration_time; | 1373 | pending->timeout = expiration_time; |
@@ -1424,6 +1454,9 @@ handle_dht_p2p_put (void *cls, | |||
1424 | GNUNET_break_op (0); | 1454 | GNUNET_break_op (0); |
1425 | return GNUNET_YES; | 1455 | return GNUNET_YES; |
1426 | } | 1456 | } |
1457 | GNUNET_STATISTICS_update (GDS_stats, | ||
1458 | gettext_noop ("# P2P PUT requests received"), 1, | ||
1459 | GNUNET_NO); | ||
1427 | put_path = (const struct GNUNET_PeerIdentity*) &put[1]; | 1460 | put_path = (const struct GNUNET_PeerIdentity*) &put[1]; |
1428 | payload = &put_path[putlen]; | 1461 | payload = &put_path[putlen]; |
1429 | options = ntohl (put->options); | 1462 | options = ntohl (put->options); |
@@ -1619,6 +1652,9 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1619 | GNUNET_break_op (0); | 1652 | GNUNET_break_op (0); |
1620 | return GNUNET_YES; | 1653 | return GNUNET_YES; |
1621 | } | 1654 | } |
1655 | GNUNET_STATISTICS_update (GDS_stats, | ||
1656 | gettext_noop ("# P2P GET requests received"), 1, | ||
1657 | GNUNET_NO); | ||
1622 | reply_bf_size = msize - (sizeof (struct PeerGetMessage) + xquery_size); | 1658 | reply_bf_size = msize - (sizeof (struct PeerGetMessage) + xquery_size); |
1623 | type = ntohl (get->type); | 1659 | type = ntohl (get->type); |
1624 | options = ntohl (get->options); | 1660 | options = ntohl (get->options); |
@@ -1663,6 +1699,9 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1663 | { | 1699 | { |
1664 | if ( (0 != (options & GNUNET_DHT_RO_FIND_PEER))) | 1700 | if ( (0 != (options & GNUNET_DHT_RO_FIND_PEER))) |
1665 | { | 1701 | { |
1702 | GNUNET_STATISTICS_update (GDS_stats, | ||
1703 | gettext_noop ("# P2P FIND PEER requests processed"), 1, | ||
1704 | GNUNET_NO); | ||
1666 | handle_find_peer (peer, | 1705 | handle_find_peer (peer, |
1667 | &get->key, | 1706 | &get->key, |
1668 | reply_bf, | 1707 | reply_bf, |
@@ -1740,6 +1779,9 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1740 | GNUNET_break_op (0); | 1779 | GNUNET_break_op (0); |
1741 | return GNUNET_YES; | 1780 | return GNUNET_YES; |
1742 | } | 1781 | } |
1782 | GNUNET_STATISTICS_update (GDS_stats, | ||
1783 | gettext_noop ("# P2P RESULTS received"), 1, | ||
1784 | GNUNET_NO); | ||
1743 | put_path = (const struct GNUNET_PeerIdentity*) &prm[1]; | 1785 | put_path = (const struct GNUNET_PeerIdentity*) &prm[1]; |
1744 | get_path = &put_path[put_path_length]; | 1786 | get_path = &put_path[put_path_length]; |
1745 | type = ntohl (prm->type); | 1787 | type = ntohl (prm->type); |
diff --git a/src/dht/gnunet-service-dht_nse.c b/src/dht/gnunet-service-dht_nse.c index b8cda34bd..94fecb413 100644 --- a/src/dht/gnunet-service-dht_nse.c +++ b/src/dht/gnunet-service-dht_nse.c | |||
@@ -55,6 +55,9 @@ static void | |||
55 | update_network_size_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, | 55 | update_network_size_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, |
56 | double logestimate, double std_dev) | 56 | double logestimate, double std_dev) |
57 | { | 57 | { |
58 | GNUNET_STATISTICS_update (GDS_stats, | ||
59 | gettext_noop ("# Network size estimates received"), 1, | ||
60 | GNUNET_NO); | ||
58 | log_of_network_size_estimate = logestimate; | 61 | log_of_network_size_estimate = logestimate; |
59 | } | 62 | } |
60 | 63 | ||
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index 5a87f8b32..607c756c6 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -216,6 +216,9 @@ process (void *cls, | |||
216 | { | 216 | { |
217 | case GNUNET_BLOCK_EVALUATION_OK_MORE: | 217 | case GNUNET_BLOCK_EVALUATION_OK_MORE: |
218 | case GNUNET_BLOCK_EVALUATION_OK_LAST: | 218 | case GNUNET_BLOCK_EVALUATION_OK_LAST: |
219 | GNUNET_STATISTICS_update (GDS_stats, | ||
220 | gettext_noop ("# Good REPLIES matched against routing table"), 1, | ||
221 | GNUNET_NO); | ||
219 | GDS_NEIGHBOURS_handle_reply (&rr->peer, | 222 | GDS_NEIGHBOURS_handle_reply (&rr->peer, |
220 | pc->type, | 223 | pc->type, |
221 | pc->expiration_time, | 224 | pc->expiration_time, |
@@ -228,15 +231,23 @@ process (void *cls, | |||
228 | pc->data_size); | 231 | pc->data_size); |
229 | break; | 232 | break; |
230 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | 233 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: |
234 | GNUNET_STATISTICS_update (GDS_stats, | ||
235 | gettext_noop ("# Duplicate REPLIES matched against routing table"), 1, | ||
236 | GNUNET_NO); | ||
231 | return GNUNET_OK; | 237 | return GNUNET_OK; |
232 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: | 238 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: |
233 | GNUNET_break_op (0); | 239 | GNUNET_STATISTICS_update (GDS_stats, |
240 | gettext_noop ("# Invalid REPLIES matched against routing table"), 1, | ||
241 | GNUNET_NO); | ||
234 | return GNUNET_SYSERR; | 242 | return GNUNET_SYSERR; |
235 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: | 243 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: |
236 | case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID: | 244 | case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID: |
237 | GNUNET_break (0); | 245 | GNUNET_break (0); |
238 | return GNUNET_OK; | 246 | return GNUNET_OK; |
239 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: | 247 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: |
248 | GNUNET_STATISTICS_update (GDS_stats, | ||
249 | gettext_noop ("# Unsupported REPLIES matched against routing table"), 1, | ||
250 | GNUNET_NO); | ||
240 | return GNUNET_SYSERR; | 251 | return GNUNET_SYSERR; |
241 | default: | 252 | default: |
242 | GNUNET_break (0); | 253 | GNUNET_break (0); |
@@ -317,6 +328,9 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | |||
317 | 328 | ||
318 | while (GNUNET_CONTAINER_heap_get_size (recent_heap) >= DHT_MAX_RECENT) | 329 | while (GNUNET_CONTAINER_heap_get_size (recent_heap) >= DHT_MAX_RECENT) |
319 | { | 330 | { |
331 | GNUNET_STATISTICS_update (GDS_stats, | ||
332 | gettext_noop ("# Entries removed from routing table"), 1, | ||
333 | GNUNET_NO); | ||
320 | recent_req = GNUNET_CONTAINER_heap_peek (recent_heap); | 334 | recent_req = GNUNET_CONTAINER_heap_peek (recent_heap); |
321 | GNUNET_assert (recent_req != NULL); | 335 | GNUNET_assert (recent_req != NULL); |
322 | GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); | 336 | GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); |
@@ -324,6 +338,9 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | |||
324 | GNUNET_free (recent_req); | 338 | GNUNET_free (recent_req); |
325 | } | 339 | } |
326 | 340 | ||
341 | GNUNET_STATISTICS_update (GDS_stats, | ||
342 | gettext_noop ("# Entries added to routing table"), 1, | ||
343 | GNUNET_NO); | ||
327 | recent_req = GNUNET_malloc (sizeof (struct RecentRequest) + xquery_size); | 344 | recent_req = GNUNET_malloc (sizeof (struct RecentRequest) + xquery_size); |
328 | recent_req->peer = *sender; | 345 | recent_req->peer = *sender; |
329 | recent_req->key = *key; | 346 | recent_req->key = *key; |
@@ -369,6 +386,9 @@ GDS_ROUTING_done () | |||
369 | 386 | ||
370 | while (GNUNET_CONTAINER_heap_get_size (recent_heap) > 0) | 387 | while (GNUNET_CONTAINER_heap_get_size (recent_heap) > 0) |
371 | { | 388 | { |
389 | GNUNET_STATISTICS_update (GDS_stats, | ||
390 | gettext_noop ("# Entries removed from routing table"), 1, | ||
391 | GNUNET_NO); | ||
372 | recent_req = GNUNET_CONTAINER_heap_peek (recent_heap); | 392 | recent_req = GNUNET_CONTAINER_heap_peek (recent_heap); |
373 | GNUNET_assert (recent_req != NULL); | 393 | GNUNET_assert (recent_req != NULL); |
374 | GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); | 394 | GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); |
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index 7605d8499..a38da8c73 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include "gnunet_os_lib.h" | 31 | #include "gnunet_os_lib.h" |
32 | #include "gnunet_program_lib.h" | 32 | #include "gnunet_program_lib.h" |
33 | #include "gnunet_scheduler_lib.h" | 33 | #include "gnunet_scheduler_lib.h" |
34 | #include "gnunet_dht_service.h" | 34 | #include "gnunet_dht_service_new.h" |
35 | #include "gnunet_hello_lib.h" | 35 | #include "gnunet_hello_lib.h" |
36 | 36 | ||
37 | #define VERBOSE GNUNET_NO | 37 | #define VERBOSE GNUNET_NO |
@@ -82,8 +82,6 @@ struct PeerContext | |||
82 | struct GNUNET_DHT_Handle *dht_handle; | 82 | struct GNUNET_DHT_Handle *dht_handle; |
83 | struct GNUNET_PeerIdentity id; | 83 | struct GNUNET_PeerIdentity id; |
84 | struct GNUNET_DHT_GetHandle *get_handle; | 84 | struct GNUNET_DHT_GetHandle *get_handle; |
85 | struct GNUNET_DHT_FindPeerHandle *find_peer_handle; | ||
86 | |||
87 | #if START_ARM | 85 | #if START_ARM |
88 | struct GNUNET_OS_Process *arm_proc; | 86 | struct GNUNET_OS_Process *arm_proc; |
89 | #endif | 87 | #endif |
@@ -139,12 +137,6 @@ end_badly () | |||
139 | #endif | 137 | #endif |
140 | 138 | ||
141 | if ((retry_context.peer_ctx != NULL) && | 139 | if ((retry_context.peer_ctx != NULL) && |
142 | (retry_context.peer_ctx->find_peer_handle != NULL)) | ||
143 | { | ||
144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping find peer request!\n"); | ||
145 | GNUNET_DHT_find_peer_stop (retry_context.peer_ctx->find_peer_handle); | ||
146 | } | ||
147 | if ((retry_context.peer_ctx != NULL) && | ||
148 | (retry_context.peer_ctx->get_handle != NULL)) | 140 | (retry_context.peer_ctx->get_handle != NULL)) |
149 | { | 141 | { |
150 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping get request!\n"); | 142 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping get request!\n"); |
@@ -163,197 +155,7 @@ end_badly () | |||
163 | * @param cls closure | 155 | * @param cls closure |
164 | * @param tc context information (why was this task triggered now) | 156 | * @param tc context information (why was this task triggered now) |
165 | */ | 157 | */ |
166 | void | 158 | static void |
167 | test_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
168 | { | ||
169 | struct PeerContext *peer = cls; | ||
170 | |||
171 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer_stop!\n"); | ||
172 | if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) | ||
173 | { | ||
174 | GNUNET_break (0); | ||
175 | GNUNET_SCHEDULER_cancel (die_task); | ||
176 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | GNUNET_assert (peer->dht_handle != NULL); | ||
181 | |||
182 | GNUNET_DHT_find_peer_stop (peer->find_peer_handle); | ||
183 | peer->find_peer_handle = NULL; | ||
184 | |||
185 | #if HAVE_MALICIOUS | ||
186 | GNUNET_DHT_set_malicious_getter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS, | ||
187 | NULL, NULL); | ||
188 | GNUNET_DHT_set_malicious_putter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS, | ||
189 | NULL, NULL); | ||
190 | GNUNET_DHT_set_malicious_dropper (peer->dht_handle, NULL, NULL); | ||
191 | #endif | ||
192 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
193 | (GNUNET_TIME_UNIT_SECONDS, 1), &end, &p1); | ||
194 | } | ||
195 | |||
196 | |||
197 | /** | ||
198 | * Iterator called on each result obtained from a find peer | ||
199 | * operation | ||
200 | * | ||
201 | * @param cls closure (NULL) | ||
202 | * @param peer the peer we learned about | ||
203 | * @param reply response | ||
204 | */ | ||
205 | void | ||
206 | test_find_peer_processor (void *cls, const struct GNUNET_HELLO_Message *hello) | ||
207 | { | ||
208 | struct RetryContext *retry_ctx = cls; | ||
209 | struct GNUNET_PeerIdentity peer; | ||
210 | |||
211 | if (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer)) | ||
212 | { | ||
213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
214 | "test_find_peer_processor called (peer `%s'), stopping find peer request!\n", | ||
215 | GNUNET_i2s (&peer)); | ||
216 | |||
217 | if (retry_ctx->retry_task != GNUNET_SCHEDULER_NO_TASK) | ||
218 | { | ||
219 | GNUNET_SCHEDULER_cancel (retry_ctx->retry_task); | ||
220 | retry_ctx->retry_task = GNUNET_SCHEDULER_NO_TASK; | ||
221 | } | ||
222 | |||
223 | GNUNET_SCHEDULER_add_continuation (&test_find_peer_stop, &p1, | ||
224 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
229 | "received find peer request, but hello_get_id failed!\n"); | ||
230 | } | ||
231 | |||
232 | } | ||
233 | |||
234 | /** | ||
235 | * Retry the find_peer task on timeout. (Forward declaration) | ||
236 | * | ||
237 | * @param cls closure | ||
238 | * @param tc context information (why was this task triggered now?) | ||
239 | */ | ||
240 | void | ||
241 | retry_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
242 | |||
243 | /** | ||
244 | * Retry the find_peer task on timeout. | ||
245 | * | ||
246 | * @param cls closure | ||
247 | * @param tc context information (why was this task triggered now) | ||
248 | */ | ||
249 | void | ||
250 | retry_find_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
251 | { | ||
252 | struct RetryContext *retry_ctx = cls; | ||
253 | GNUNET_HashCode hash; | ||
254 | |||
255 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | ||
256 | |||
257 | if (GNUNET_TIME_absolute_get_remaining (retry_ctx->real_timeout).rel_value > | ||
258 | 0) | ||
259 | { | ||
260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
261 | "test_find_peer timed out, retrying!\n"); | ||
262 | retry_ctx->next_timeout = | ||
263 | GNUNET_TIME_relative_multiply (retry_ctx->next_timeout, 2); | ||
264 | retry_ctx->peer_ctx->find_peer_handle = | ||
265 | GNUNET_DHT_find_peer_start (retry_ctx->peer_ctx->dht_handle, | ||
266 | retry_ctx->next_timeout, &hash, | ||
267 | GNUNET_DHT_RO_NONE, | ||
268 | &test_find_peer_processor, retry_ctx); | ||
269 | } | ||
270 | else | ||
271 | { | ||
272 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
273 | "test_find_peer timed out for good, failing!\n"); | ||
274 | |||
275 | retry_ctx->peer_ctx->find_peer_handle = NULL; | ||
276 | } | ||
277 | |||
278 | if (retry_ctx->peer_ctx->find_peer_handle == NULL) | ||
279 | { | ||
280 | GNUNET_break (0); | ||
281 | GNUNET_SCHEDULER_cancel (die_task); | ||
282 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, &p1); | ||
283 | return; | ||
284 | } | ||
285 | retry_ctx->retry_task = | ||
286 | GNUNET_SCHEDULER_add_delayed (retry_ctx->next_timeout, | ||
287 | &retry_find_peer_stop, retry_ctx); | ||
288 | } | ||
289 | |||
290 | /** | ||
291 | * Retry the find_peer task on timeout. | ||
292 | * | ||
293 | * @param cls closure | ||
294 | * @param tc context information (why was this task triggered now?) | ||
295 | */ | ||
296 | void | ||
297 | retry_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
298 | { | ||
299 | struct RetryContext *retry_ctx = cls; | ||
300 | GNUNET_HashCode hash; | ||
301 | |||
302 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | ||
303 | |||
304 | if (retry_ctx->peer_ctx->find_peer_handle != NULL) | ||
305 | { | ||
306 | GNUNET_DHT_find_peer_stop (retry_ctx->peer_ctx->find_peer_handle); | ||
307 | retry_ctx->peer_ctx->find_peer_handle = NULL; | ||
308 | } | ||
309 | GNUNET_SCHEDULER_add_now (&retry_find_peer, retry_ctx); | ||
310 | } | ||
311 | |||
312 | /** | ||
313 | * Entry point for test of find_peer functionality. | ||
314 | * | ||
315 | * @param cls closure | ||
316 | * @param tc context information (why was this task triggered now) | ||
317 | */ | ||
318 | void | ||
319 | test_find_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
320 | { | ||
321 | struct PeerContext *peer = cls; | ||
322 | GNUNET_HashCode hash; | ||
323 | |||
324 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | ||
325 | |||
326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer!\n"); | ||
327 | GNUNET_assert (peer->dht_handle != NULL); | ||
328 | |||
329 | retry_context.real_timeout = GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT); | ||
330 | retry_context.next_timeout = BASE_TIMEOUT; | ||
331 | retry_context.peer_ctx = peer; | ||
332 | |||
333 | peer->find_peer_handle = | ||
334 | GNUNET_DHT_find_peer_start (peer->dht_handle, retry_context.next_timeout, | ||
335 | &hash, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, | ||
336 | &test_find_peer_processor, &retry_context); | ||
337 | |||
338 | if (peer->find_peer_handle == NULL) | ||
339 | { | ||
340 | GNUNET_break (0); | ||
341 | GNUNET_SCHEDULER_cancel (die_task); | ||
342 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, &p1); | ||
343 | return; | ||
344 | } | ||
345 | retry_context.retry_task = | ||
346 | GNUNET_SCHEDULER_add_delayed (retry_context.next_timeout, | ||
347 | &retry_find_peer_stop, &retry_context); | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * Signature of the main function of a task. | ||
352 | * | ||
353 | * @param cls closure | ||
354 | * @param tc context information (why was this task triggered now) | ||
355 | */ | ||
356 | void | ||
357 | test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 159 | test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
358 | { | 160 | { |
359 | struct PeerContext *peer = cls; | 161 | struct PeerContext *peer = cls; |
@@ -369,14 +171,17 @@ test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
369 | GNUNET_assert (peer->dht_handle != NULL); | 171 | GNUNET_assert (peer->dht_handle != NULL); |
370 | GNUNET_DHT_get_stop (peer->get_handle); | 172 | GNUNET_DHT_get_stop (peer->get_handle); |
371 | peer->get_handle = NULL; | 173 | peer->get_handle = NULL; |
372 | GNUNET_SCHEDULER_add_now (&test_find_peer, &p1); | 174 | GNUNET_SCHEDULER_add_now (&end, &p1); |
373 | } | 175 | } |
374 | 176 | ||
375 | void | 177 | |
178 | static void | ||
376 | test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | 179 | test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, |
377 | const GNUNET_HashCode * key, | 180 | const GNUNET_HashCode * key, |
378 | const struct GNUNET_PeerIdentity *const *get_path, | 181 | const struct GNUNET_PeerIdentity *get_path, |
379 | const struct GNUNET_PeerIdentity *const *put_path, | 182 | unsigned int get_path_length, |
183 | const struct GNUNET_PeerIdentity *put_path, | ||
184 | unsigned int put_path_length, | ||
380 | enum GNUNET_BLOCK_Type type, size_t size, const void *data) | 185 | enum GNUNET_BLOCK_Type type, size_t size, const void *data) |
381 | { | 186 | { |
382 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -409,8 +214,8 @@ test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
409 | peer->get_handle = | 214 | peer->get_handle = |
410 | GNUNET_DHT_get_start (peer->dht_handle, TOTAL_TIMEOUT, | 215 | GNUNET_DHT_get_start (peer->dht_handle, TOTAL_TIMEOUT, |
411 | GNUNET_BLOCK_TYPE_TEST, &hash, | 216 | GNUNET_BLOCK_TYPE_TEST, &hash, |
412 | DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, NULL, | 217 | 1, GNUNET_DHT_RO_NONE, NULL, |
413 | 0, NULL, 0, &test_get_iterator, NULL); | 218 | 0, &test_get_iterator, NULL); |
414 | 219 | ||
415 | if (peer->get_handle == NULL) | 220 | if (peer->get_handle == NULL) |
416 | { | 221 | { |
@@ -445,7 +250,7 @@ test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
445 | 250 | ||
446 | GNUNET_assert (peer->dht_handle != NULL); | 251 | GNUNET_assert (peer->dht_handle != NULL); |
447 | 252 | ||
448 | GNUNET_DHT_put (peer->dht_handle, &hash, DEFAULT_PUT_REPLICATION, | 253 | GNUNET_DHT_put (peer->dht_handle, &hash, 1, |
449 | GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST, data_size, data, | 254 | GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST, data_size, data, |
450 | GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT), | 255 | GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT), |
451 | TOTAL_TIMEOUT, &test_get, &p1); | 256 | TOTAL_TIMEOUT, &test_get, &p1); |
diff --git a/src/dht/test_dht_api_peer1.conf b/src/dht/test_dht_api_peer1.conf index ae0d2ff49..5c3c14ba3 100644 --- a/src/dht/test_dht_api_peer1.conf +++ b/src/dht/test_dht_api_peer1.conf | |||
@@ -11,6 +11,7 @@ ACCEPT_FROM6 = ::1; | |||
11 | ACCEPT_FROM = 127.0.0.1; | 11 | ACCEPT_FROM = 127.0.0.1; |
12 | HOSTNAME = localhost | 12 | HOSTNAME = localhost |
13 | PORT = 2100 | 13 | PORT = 2100 |
14 | BINARY = gnunet-service-dht-new | ||
14 | 15 | ||
15 | [block] | 16 | [block] |
16 | plugins = dht test | 17 | plugins = dht test |