diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 19 | ||||
-rw-r--r-- | src/fs/fs.c | 2 | ||||
-rw-r--r-- | src/fs/gnunet-pseudonym.c | 2 | ||||
-rw-r--r-- | src/testing/testing.c | 13 | ||||
-rw-r--r-- | src/testing/testing_group.c | 50 |
5 files changed, 47 insertions, 39 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 1e826096c..630c6a35b 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -2154,8 +2154,9 @@ route_result_message (struct GNUNET_MessageHeader *msg, | |||
2154 | struct DHTRouteSource *pos; | 2154 | struct DHTRouteSource *pos; |
2155 | struct PeerInfo *peer_info; | 2155 | struct PeerInfo *peer_info; |
2156 | const struct GNUNET_MessageHeader *hello_msg; | 2156 | const struct GNUNET_MessageHeader *hello_msg; |
2157 | #if DEBUG_DHT > 1 | ||
2157 | unsigned int i; | 2158 | unsigned int i; |
2158 | char *path_offset; | 2159 | #endif |
2159 | 2160 | ||
2160 | increment_stats (STAT_RESULTS); | 2161 | increment_stats (STAT_RESULTS); |
2161 | /** | 2162 | /** |
@@ -2271,14 +2272,18 @@ route_result_message (struct GNUNET_MessageHeader *msg, | |||
2271 | increment_stats (STAT_RESULTS_TO_CLIENT); | 2272 | increment_stats (STAT_RESULTS_TO_CLIENT); |
2272 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_DHT_GET_RESULT) | 2273 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_DHT_GET_RESULT) |
2273 | increment_stats (STAT_GET_REPLY); | 2274 | increment_stats (STAT_GET_REPLY); |
2274 | 2275 | #if DEBUG_DHT > 1 | |
2275 | for (i = 0; i < msg_ctx->path_history_len; i++) | 2276 | for (i = 0; i < msg_ctx->path_history_len; i++) |
2276 | { | 2277 | { |
2278 | char *path_offset; | ||
2279 | |||
2277 | path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)]; | 2280 | path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)]; |
2278 | #if DEBUG_DHT > 1 | 2281 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
2279 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "(before client) Key %s Found peer %d:%s\n", GNUNET_h2s(&msg_ctx->key), i, GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset)); | 2282 | "(before client) Key %s Found peer %d:%s\n", |
2280 | #endif | 2283 | GNUNET_h2s(&msg_ctx->key), i, |
2284 | GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset)); | ||
2281 | } | 2285 | } |
2286 | #endif | ||
2282 | send_reply_to_client (pos->client, msg, msg_ctx); | 2287 | send_reply_to_client (pos->client, msg, msg_ctx); |
2283 | } | 2288 | } |
2284 | else /* Send to peer */ | 2289 | else /* Send to peer */ |
@@ -3382,7 +3387,6 @@ select_peer (const GNUNET_HashCode * target, | |||
3382 | unsigned int i; | 3387 | unsigned int i; |
3383 | unsigned int count; | 3388 | unsigned int count; |
3384 | unsigned int offset; | 3389 | unsigned int offset; |
3385 | unsigned int my_matching_bits; | ||
3386 | int closest_bucket; | 3390 | int closest_bucket; |
3387 | struct PeerInfo *pos; | 3391 | struct PeerInfo *pos; |
3388 | struct PeerInfo *sorted_closest[bucket_size]; | 3392 | struct PeerInfo *sorted_closest[bucket_size]; |
@@ -3398,9 +3402,6 @@ select_peer (const GNUNET_HashCode * target, | |||
3398 | unsigned int largest_distance; | 3402 | unsigned int largest_distance; |
3399 | struct PeerInfo *chosen; | 3403 | struct PeerInfo *chosen; |
3400 | 3404 | ||
3401 | my_matching_bits = | ||
3402 | GNUNET_CRYPTO_hash_matching_bits (target, &my_identity.hashPubKey); | ||
3403 | |||
3404 | total_distance = 0; | 3405 | total_distance = 0; |
3405 | /** If we are doing kademlia routing, or converge is binary (saves some cycles) */ | 3406 | /** If we are doing kademlia routing, or converge is binary (saves some cycles) */ |
3406 | if ((strict_kademlia == GNUNET_YES) || | 3407 | if ((strict_kademlia == GNUNET_YES) || |
diff --git a/src/fs/fs.c b/src/fs/fs.c index 307952a17..fdaa12205 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c | |||
@@ -2625,7 +2625,6 @@ deserialize_download (struct GNUNET_FS_Handle *h, | |||
2625 | const char *serialization) | 2625 | const char *serialization) |
2626 | { | 2626 | { |
2627 | struct GNUNET_FS_DownloadContext *dc; | 2627 | struct GNUNET_FS_DownloadContext *dc; |
2628 | struct DownloadRequest *dr; | ||
2629 | char *emsg; | 2628 | char *emsg; |
2630 | char *uris; | 2629 | char *uris; |
2631 | char *dn; | 2630 | char *dn; |
@@ -2634,7 +2633,6 @@ deserialize_download (struct GNUNET_FS_Handle *h, | |||
2634 | 2633 | ||
2635 | uris = NULL; | 2634 | uris = NULL; |
2636 | emsg = NULL; | 2635 | emsg = NULL; |
2637 | dr = NULL; | ||
2638 | dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); | 2636 | dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); |
2639 | dc->parent = parent; | 2637 | dc->parent = parent; |
2640 | dc->h = h; | 2638 | dc->h = h; |
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c index d7a13e486..348805904 100644 --- a/src/fs/gnunet-pseudonym.c +++ b/src/fs/gnunet-pseudonym.c | |||
@@ -226,7 +226,6 @@ run (void *cls, | |||
226 | const char *cfgfile, | 226 | const char *cfgfile, |
227 | const struct GNUNET_CONFIGURATION_Handle *c) | 227 | const struct GNUNET_CONFIGURATION_Handle *c) |
228 | { | 228 | { |
229 | struct GNUNET_TIME_Absolute expiration; | ||
230 | char *emsg; | 229 | char *emsg; |
231 | 230 | ||
232 | cfg = c; | 231 | cfg = c; |
@@ -263,7 +262,6 @@ run (void *cls, | |||
263 | { | 262 | { |
264 | if (NULL != root_identifier) | 263 | if (NULL != root_identifier) |
265 | { | 264 | { |
266 | expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS); | ||
267 | if (ksk_uri == NULL) | 265 | if (ksk_uri == NULL) |
268 | { | 266 | { |
269 | emsg = NULL; | 267 | emsg = NULL; |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 9558f45eb..dafe0efbe 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -63,18 +63,22 @@ static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} }; | |||
63 | * @param message HELLO message of peer | 63 | * @param message HELLO message of peer |
64 | */ | 64 | */ |
65 | static void | 65 | static void |
66 | process_hello (void *cls, const struct GNUNET_MessageHeader *message) | 66 | process_hello (void *cls, |
67 | const struct GNUNET_MessageHeader *message) | ||
67 | { | 68 | { |
68 | struct GNUNET_TESTING_Daemon *daemon = cls; | 69 | struct GNUNET_TESTING_Daemon *daemon = cls; |
70 | #if WAIT_FOR_HELLO | ||
69 | GNUNET_TESTING_NotifyDaemonRunning cb; | 71 | GNUNET_TESTING_NotifyDaemonRunning cb; |
72 | #endif | ||
70 | 73 | ||
71 | int msize; | 74 | int msize; |
72 | if (daemon == NULL) | 75 | if (daemon == NULL) |
73 | return; | 76 | return; |
74 | 77 | ||
75 | GNUNET_assert (daemon->phase == SP_GET_HELLO || daemon->phase == SP_START_DONE); | 78 | GNUNET_assert (daemon->phase == SP_GET_HELLO || daemon->phase == SP_START_DONE); |
76 | 79 | #if WAIT_FOR_HELLO | |
77 | cb = daemon->cb; | 80 | cb = daemon->cb; |
81 | #endif | ||
78 | daemon->cb = NULL; | 82 | daemon->cb = NULL; |
79 | if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */ | 83 | if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */ |
80 | GNUNET_SCHEDULER_cancel(daemon->task); | 84 | GNUNET_SCHEDULER_cancel(daemon->task); |
@@ -119,7 +123,10 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
119 | 123 | ||
120 | #if WAIT_FOR_HELLO | 124 | #if WAIT_FOR_HELLO |
121 | if (NULL != cb) /* FIXME: what happens when this callback calls GNUNET_TESTING_daemon_stop? */ | 125 | if (NULL != cb) /* FIXME: what happens when this callback calls GNUNET_TESTING_daemon_stop? */ |
122 | cb (daemon->cb_cls, &daemon->id, daemon->cfg, daemon, NULL); | 126 | cb (daemon->cb_cls, |
127 | &daemon->id, | ||
128 | daemon->cfg, | ||
129 | daemon, NULL); | ||
123 | #endif | 130 | #endif |
124 | } | 131 | } |
125 | 132 | ||
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index b1e3beb8c..66bcae842 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -2424,16 +2424,17 @@ static unsigned int | |||
2424 | copy_allowed(struct GNUNET_TESTING_PeerGroup *pg, | 2424 | copy_allowed(struct GNUNET_TESTING_PeerGroup *pg, |
2425 | GNUNET_TESTING_ConnectionProcessor proc) | 2425 | GNUNET_TESTING_ConnectionProcessor proc) |
2426 | { | 2426 | { |
2427 | struct UnblacklistContext un_ctx; | ||
2428 | unsigned int count; | 2427 | unsigned int count; |
2429 | unsigned int total; | 2428 | unsigned int total; |
2430 | struct PeerConnection *iter; | 2429 | struct PeerConnection *iter; |
2430 | #if !OLD | ||
2431 | struct UnblacklistContext un_ctx; | ||
2431 | 2432 | ||
2432 | un_ctx.pg = pg; | 2433 | un_ctx.pg = pg; |
2434 | #endif | ||
2433 | total = 0; | 2435 | total = 0; |
2434 | for (count = 0; count < pg->total - 1; count++) | 2436 | for (count = 0; count < pg->total - 1; count++) |
2435 | { | 2437 | { |
2436 | un_ctx.first_uid = count; | ||
2437 | #if OLD | 2438 | #if OLD |
2438 | iter = pg->peers[count].allowed_peers_head; | 2439 | iter = pg->peers[count].allowed_peers_head; |
2439 | while (iter != NULL) | 2440 | while (iter != NULL) |
@@ -2443,10 +2444,15 @@ copy_allowed(struct GNUNET_TESTING_PeerGroup *pg, | |||
2443 | iter = iter->next; | 2444 | iter = iter->next; |
2444 | } | 2445 | } |
2445 | #else | 2446 | #else |
2446 | total += GNUNET_CONTAINER_multihashmap_iterate(pg->peers[count].allowed_peers, &unblacklist_iterator, &un_ctx); | 2447 | un_ctx.first_uid = count; |
2448 | total += GNUNET_CONTAINER_multihashmap_iterate(pg->peers[count].allowed_peers, | ||
2449 | &unblacklist_iterator, | ||
2450 | &un_ctx); | ||
2447 | #endif | 2451 | #endif |
2448 | } | 2452 | } |
2449 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unblacklisted %u peers\n", total); | 2453 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2454 | "Unblacklisted %u peers\n", | ||
2455 | total); | ||
2450 | return total; | 2456 | return total; |
2451 | } | 2457 | } |
2452 | 2458 | ||
@@ -2467,16 +2473,16 @@ create_line(struct GNUNET_TESTING_PeerGroup *pg, | |||
2467 | GNUNET_TESTING_ConnectionProcessor proc, enum PeerLists list) | 2473 | GNUNET_TESTING_ConnectionProcessor proc, enum PeerLists list) |
2468 | { | 2474 | { |
2469 | unsigned int count; | 2475 | unsigned int count; |
2470 | int connect_attempts; | 2476 | unsigned int connect_attempts; |
2471 | 2477 | ||
2472 | connect_attempts = 0; | 2478 | connect_attempts = 0; |
2473 | |||
2474 | /* Connect each peer to the next highest numbered peer */ | 2479 | /* Connect each peer to the next highest numbered peer */ |
2475 | for (count = 0; count < pg->total - 1; count++) | 2480 | for (count = 0; count < pg->total - 1; count++) |
2476 | { | 2481 | { |
2477 | #if VERBOSE_TESTING | 2482 | #if VERBOSE_TESTING |
2478 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2483 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2479 | "Connecting peer %d to peer %d\n", count, count + 1); | 2484 | "Connecting peer %d to peer %d\n", |
2485 | count, count + 1); | ||
2480 | #endif | 2486 | #endif |
2481 | connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES); | 2487 | connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES); |
2482 | } | 2488 | } |
@@ -2504,15 +2510,14 @@ create_from_file(struct GNUNET_TESTING_PeerGroup *pg, char *filename, | |||
2504 | int connect_attempts; | 2510 | int connect_attempts; |
2505 | unsigned int first_peer_index; | 2511 | unsigned int first_peer_index; |
2506 | unsigned int second_peer_index; | 2512 | unsigned int second_peer_index; |
2507 | connect_attempts = 0; | ||
2508 | struct stat frstat; | 2513 | struct stat frstat; |
2509 | int count; | 2514 | int count; |
2510 | char *data; | 2515 | char *data; |
2511 | char *buf; | 2516 | char *buf; |
2512 | unsigned int total_peers; | 2517 | unsigned int total_peers; |
2513 | |||
2514 | enum States curr_state; | 2518 | enum States curr_state; |
2515 | 2519 | ||
2520 | connect_attempts = 0; | ||
2516 | if (GNUNET_OK != GNUNET_DISK_file_test (filename)) | 2521 | if (GNUNET_OK != GNUNET_DISK_file_test (filename)) |
2517 | GNUNET_DISK_fn_write (filename, NULL, 0, GNUNET_DISK_PERM_USER_READ); | 2522 | GNUNET_DISK_fn_write (filename, NULL, 0, GNUNET_DISK_PERM_USER_READ); |
2518 | 2523 | ||
@@ -4272,22 +4277,17 @@ void | |||
4272 | choose_random_connections(struct GNUNET_TESTING_PeerGroup *pg, | 4277 | choose_random_connections(struct GNUNET_TESTING_PeerGroup *pg, |
4273 | double percentage) | 4278 | double percentage) |
4274 | { | 4279 | { |
4275 | struct RandomContext random_ctx; | ||
4276 | uint32_t pg_iter; | 4280 | uint32_t pg_iter; |
4277 | #if OLD | 4281 | #if OLD |
4278 | struct PeerConnection *temp_peers; | ||
4279 | struct PeerConnection *conn_iter; | 4282 | struct PeerConnection *conn_iter; |
4280 | double random_number; | 4283 | double random_number; |
4284 | #else | ||
4285 | struct RandomContext random_ctx; | ||
4281 | #endif | 4286 | #endif |
4282 | 4287 | ||
4283 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) | 4288 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) |
4284 | { | 4289 | { |
4285 | random_ctx.first_uid = pg_iter; | ||
4286 | random_ctx.first = &pg->peers[pg_iter]; | ||
4287 | random_ctx.percentage = percentage; | ||
4288 | random_ctx.pg = pg; | ||
4289 | #if OLD | 4290 | #if OLD |
4290 | temp_peers = NULL; | ||
4291 | conn_iter = pg->peers[pg_iter].connect_peers_head; | 4291 | conn_iter = pg->peers[pg_iter].connect_peers_head; |
4292 | while (conn_iter != NULL) | 4292 | while (conn_iter != NULL) |
4293 | { | 4293 | { |
@@ -4303,17 +4303,21 @@ choose_random_connections(struct GNUNET_TESTING_PeerGroup *pg, | |||
4303 | conn_iter = conn_iter->next; | 4303 | conn_iter = conn_iter->next; |
4304 | } | 4304 | } |
4305 | #else | 4305 | #else |
4306 | pg->peers[pg_iter].connect_peers_working_set = | 4306 | random_ctx.first_uid = pg_iter; |
4307 | GNUNET_CONTAINER_multihashmap_create (pg->total); | 4307 | random_ctx.first = &pg->peers[pg_iter]; |
4308 | random_ctx.percentage = percentage; | ||
4309 | random_ctx.pg = pg; | ||
4310 | pg->peers[pg_iter].connect_peers_working_set | ||
4311 | = GNUNET_CONTAINER_multihashmap_create (pg->total); | ||
4308 | GNUNET_CONTAINER_multihashmap_iterate (pg->peers[pg_iter].connect_peers, | 4312 | GNUNET_CONTAINER_multihashmap_iterate (pg->peers[pg_iter].connect_peers, |
4309 | &random_connect_iterator, | 4313 | &random_connect_iterator, |
4310 | &random_ctx); | 4314 | &random_ctx); |
4311 | /* Now remove the old connections */ | 4315 | /* Now remove the old connections */ |
4312 | GNUNET_CONTAINER_multihashmap_destroy (pg-> | 4316 | GNUNET_CONTAINER_multihashmap_destroy (pg-> |
4313 | peers[pg_iter].connect_peers); | 4317 | peers[pg_iter].connect_peers); |
4314 | /* And replace with the random set */ | 4318 | /* And replace with the random set */ |
4315 | pg->peers[pg_iter].connect_peers = | 4319 | pg->peers[pg_iter].connect_peers |
4316 | pg->peers[pg_iter].connect_peers_working_set; | 4320 | = pg->peers[pg_iter].connect_peers_working_set; |
4317 | #endif | 4321 | #endif |
4318 | } | 4322 | } |
4319 | 4323 | ||