aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/datastore/plugin_datastore_sqlite.c12
-rw-r--r--src/dht/gnunet-dht-driver.c42
-rw-r--r--src/dht/gnunet-service-dht.c93
-rw-r--r--src/dht/test_dht_twopeer_get_put.c2
-rw-r--r--src/fs/fs_test_lib.c7
-rw-r--r--src/fs/fs_test_lib.h3
-rw-r--r--src/fs/gnunet-service-fs_cp.c11
-rw-r--r--src/fs/test_fs_test_lib.c12
-rw-r--r--src/fs/test_gnunet_service_fs_migration.c14
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c12
-rw-r--r--src/include/gnunet_mesh_service_new.h40
-rw-r--r--src/include/gnunet_transport_service.h12
-rw-r--r--src/mesh/gnunet-service-mesh.c152
-rw-r--r--src/mesh/mesh_api.c2
-rw-r--r--src/mesh/mesh_api_new.c19
-rw-r--r--src/mesh/test_mesh_local_1.c38
-rw-r--r--src/mesh/test_mesh_local_2.c44
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c2
-rw-r--r--src/testing/test_testing_connect.c4
-rw-r--r--src/testing/test_testing_reconnect.c4
-rw-r--r--src/testing/testing.c153
-rw-r--r--src/testing/testing_group.c84
-rw-r--r--src/topology/test_gnunet_daemon_topology.c34
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c6
-rw-r--r--src/transport/gnunet-transport-wlan-helper.c1
-rw-r--r--src/transport/plugin_transport_wlan.c88
-rw-r--r--src/transport/test_plugin_transport_wlan_dummy.c4
-rw-r--r--src/transport/test_transport_api_limited_sockets.c23
-rw-r--r--src/transport/transport_api_address_lookup.c8
-rw-r--r--src/transport/transport_api_peer_address_lookup.c9
-rw-r--r--src/transport/wlan/helper_common.c4
-rw-r--r--src/vpn/gnunet-daemon-vpn-helper.c15
-rw-r--r--src/vpn/gnunet-service-dns.c34
33 files changed, 478 insertions, 510 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index c5952bcb0..2620c3682 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -326,15 +326,12 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
326 (sq_prepare 326 (sq_prepare
327 (plugin->dbh, 327 (plugin->dbh,
328 "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " 328 "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ "
329 "FROM gn090 INDEXED BY idx_repl_rvalue " 329 "FROM gn090 INDEXED BY idx_repl_rvalue WHERE repl=?2 AND "
330 "WHERE repl=?2 AND "
331 " (rvalue>=?1 OR " 330 " (rvalue>=?1 OR "
332 " NOT EXISTS (SELECT 1 FROM gn090 INDEXED BY idx_repl_rvalue WHERE repl=?2 AND rvalue>=?1 LIMIT 1) ) " 331 " NOT EXISTS (SELECT 1 FROM gn090 INDEXED BY idx_repl_rvalue WHERE repl=?2 AND rvalue>=?1 LIMIT 1) ) "
333 "ORDER BY rvalue ASC LIMIT 1", 332 "ORDER BY rvalue ASC LIMIT 1", &plugin->selRepl) != SQLITE_OK) ||
334 &plugin->selRepl) != SQLITE_OK) ||
335 (sq_prepare 333 (sq_prepare
336 (plugin->dbh, 334 (plugin->dbh, "SELECT MAX(repl) FROM gn090 INDEXED BY idx_repl_rvalue",
337 "SELECT MAX(repl) FROM gn090 INDEXED BY idx_repl_rvalue",
338 &plugin->maxRepl) != SQLITE_OK) || 335 &plugin->maxRepl) != SQLITE_OK) ||
339 (sq_prepare 336 (sq_prepare
340 (plugin->dbh, 337 (plugin->dbh,
@@ -355,8 +352,7 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
355 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", 352 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
356 &plugin->insertContent) != SQLITE_OK) || 353 &plugin->insertContent) != SQLITE_OK) ||
357 (sq_prepare 354 (sq_prepare
358 (plugin->dbh, 355 (plugin->dbh, "DELETE FROM gn090 WHERE _ROWID_ = ?",
359 "DELETE FROM gn090 WHERE _ROWID_ = ?",
360 &plugin->delRow) != SQLITE_OK)) 356 &plugin->delRow) != SQLITE_OK))
361 { 357 {
362 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "precompiling"); 358 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "precompiling");
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c
index c0213499c..8fa5199ab 100644
--- a/src/dht/gnunet-dht-driver.c
+++ b/src/dht/gnunet-dht-driver.c
@@ -1407,23 +1407,12 @@ add_new_connection (struct FindPeerContext *find_peer_context,
1407} 1407}
1408 1408
1409static void 1409static void
1410did_connect (void *cls, 1410did_connect (void *cls, const struct GNUNET_PeerIdentity *first,
1411 const struct 1411 const struct GNUNET_PeerIdentity *second, uint32_t distance,
1412 GNUNET_PeerIdentity * first, 1412 const struct GNUNET_CONFIGURATION_Handle *first_cfg,
1413 const struct 1413 const struct GNUNET_CONFIGURATION_Handle *second_cfg,
1414 GNUNET_PeerIdentity * second, 1414 struct GNUNET_TESTING_Daemon *first_daemon,
1415 uint32_t distance, 1415 struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
1416 const struct
1417 GNUNET_CONFIGURATION_Handle *
1418 first_cfg,
1419 const struct
1420 GNUNET_CONFIGURATION_Handle *
1421 second_cfg,
1422 struct GNUNET_TESTING_Daemon *
1423 first_daemon,
1424 struct GNUNET_TESTING_Daemon *
1425 second_daemon,
1426 const char *emsg)
1427{ 1416{
1428 struct FindPeerContext *find_peer_context = cls; 1417 struct FindPeerContext *find_peer_context = cls;
1429 1418
@@ -1457,7 +1446,8 @@ iterate_min_heap_peers (void *cls, struct GNUNET_CONTAINER_HeapNode *node,
1457 d1 = GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id); 1446 d1 = GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id);
1458 GNUNET_assert (d1 != NULL); 1447 GNUNET_assert (d1 != NULL);
1459 d2 = d1; 1448 d2 = d1;
1460 while ((d2 == d1) || (GNUNET_YES != GNUNET_TESTING_test_daemon_running (d2))) 1449 while ((d2 == d1) ||
1450 (GNUNET_YES != GNUNET_TESTING_test_daemon_running (d2)))
1461 { 1451 {
1462 d2 = GNUNET_TESTING_daemon_get (pg, 1452 d2 = GNUNET_TESTING_daemon_get (pg,
1463 GNUNET_CRYPTO_random_u32 1453 GNUNET_CRYPTO_random_u32
@@ -1479,10 +1469,10 @@ iterate_min_heap_peers (void *cls, struct GNUNET_CONTAINER_HeapNode *node,
1479 } 1469 }
1480 if (NULL != find_peer_context->cc) 1470 if (NULL != find_peer_context->cc)
1481 GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); 1471 GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc);
1482 find_peer_context->cc = GNUNET_TESTING_daemons_connect (d1, d2, timeout, DEFAULT_RECONNECT_ATTEMPTS, 1472 find_peer_context->cc =
1483 GNUNET_YES, 1473 GNUNET_TESTING_daemons_connect (d1, d2, timeout,
1484 &did_connect, 1474 DEFAULT_RECONNECT_ATTEMPTS, GNUNET_YES,
1485 find_peer_context); 1475 &did_connect, find_peer_context);
1486 } 1476 }
1487 if (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).rel_value 1477 if (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).rel_value
1488 > 0) 1478 > 0)
@@ -1602,7 +1592,7 @@ count_peers_churn_cb (void *cls, const struct GNUNET_PeerIdentity *first,
1602 GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash); 1592 GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash);
1603 GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap); 1593 GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap);
1604 if (NULL != find_peer_context->cc) 1594 if (NULL != find_peer_context->cc)
1605 GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); 1595 GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc);
1606 GNUNET_free (find_peer_context); 1596 GNUNET_free (find_peer_context);
1607 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1597 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1608 "Churn round %u of %llu finished, scheduling next GET round.\n", 1598 "Churn round %u of %llu finished, scheduling next GET round.\n",
@@ -2120,7 +2110,7 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2120 /* Set this here in case we are re-running gets */ 2110 /* Set this here in case we are re-running gets */
2121 test_get->succeeded = GNUNET_NO; 2111 test_get->succeeded = GNUNET_NO;
2122 2112
2123 if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_get->daemon)) /* If the peer has been churned off, don't try issuing request from it! */ 2113 if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_get->daemon)) /* If the peer has been churned off, don't try issuing request from it! */
2124 { 2114 {
2125 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2115 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2126 "Peer we should issue get request from is down, skipping.\n"); 2116 "Peer we should issue get request from is down, skipping.\n");
@@ -2237,7 +2227,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2237 if (test_put == NULL) 2227 if (test_put == NULL)
2238 return; /* End of list */ 2228 return; /* End of list */
2239 2229
2240 if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_put->daemon)) /* If the peer has been churned off, don't try issuing request from it! */ 2230 if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_put->daemon)) /* If the peer has been churned off, don't try issuing request from it! */
2241 { 2231 {
2242 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2243 "Peer we should issue put request at is down, skipping.\n"); 2233 "Peer we should issue put request at is down, skipping.\n");
@@ -2357,7 +2347,7 @@ count_peers_cb (void *cls, const struct GNUNET_PeerIdentity *first,
2357 GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash); 2347 GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash);
2358 GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap); 2348 GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap);
2359 if (NULL != find_peer_context->cc) 2349 if (NULL != find_peer_context->cc)
2360 GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); 2350 GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc);
2361 GNUNET_free (find_peer_context); 2351 GNUNET_free (find_peer_context);
2362 fprintf (stderr, "Not sending any more find peer requests.\n"); 2352 fprintf (stderr, "Not sending any more find peer requests.\n");
2363 2353
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 237db023c..a68ba5563 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -858,10 +858,9 @@ static struct GNUNET_NSE_Handle *nse;
858 * @param std_dev standard deviation for the estimate 858 * @param std_dev standard deviation for the estimate
859 * 859 *
860 */ 860 */
861static void 861static void
862update_network_size_estimate (void *cls, 862update_network_size_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp,
863 struct GNUNET_TIME_Absolute timestamp, 863 double logestimate, double std_dev)
864 double logestimate, double std_dev)
865{ 864{
866 log_of_network_size_estimate = logestimate; 865 log_of_network_size_estimate = logestimate;
867} 866}
@@ -947,7 +946,7 @@ increment_stats (const char *value)
947{ 946{
948 if (stats == NULL) 947 if (stats == NULL)
949 return; 948 return;
950 GNUNET_STATISTICS_update (stats, value, 1, GNUNET_NO); 949 GNUNET_STATISTICS_update (stats, value, 1, GNUNET_NO);
951} 950}
952 951
953 952
@@ -956,7 +955,7 @@ decrement_stats (const char *value)
956{ 955{
957 if (stats == NULL) 956 if (stats == NULL)
958 return; 957 return;
959 GNUNET_STATISTICS_update (stats, value, -1, GNUNET_NO); 958 GNUNET_STATISTICS_update (stats, value, -1, GNUNET_NO);
960} 959}
961 960
962 961
@@ -1630,8 +1629,7 @@ forward_message (const struct GNUNET_MessageHeader *msg, struct PeerInfo *peer,
1630static void 1629static void
1631process_pending_messages (struct ClientList *client) 1630process_pending_messages (struct ClientList *client)
1632{ 1631{
1633 if ( (client->pending_head == NULL) || 1632 if ((client->pending_head == NULL) || (client->transmit_handle != NULL))
1634 (client->transmit_handle != NULL) )
1635 return; 1633 return;
1636 client->transmit_handle = 1634 client->transmit_handle =
1637 GNUNET_SERVER_notify_transmit_ready (client->client_handle, 1635 GNUNET_SERVER_notify_transmit_ready (client->client_handle,
@@ -2659,7 +2657,8 @@ handle_dht_put (const struct GNUNET_MessageHeader *msg,
2659#endif 2657#endif
2660 2658
2661// GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "******************************************************** PUT 1\n"); 2659// GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "******************************************************** PUT 1\n");
2662 record = GNUNET_CONTAINER_multihashmap_get(forward_list.hashmap, &msg_ctx->key); 2660 record =
2661 GNUNET_CONTAINER_multihashmap_get (forward_list.hashmap, &msg_ctx->key);
2663 if (NULL != record) 2662 if (NULL != record)
2664 { 2663 {
2665 struct DHTRouteSource *pos; 2664 struct DHTRouteSource *pos;
@@ -2675,16 +2674,16 @@ handle_dht_put (const struct GNUNET_MessageHeader *msg,
2675 if (NULL == pos->client) 2674 if (NULL == pos->client)
2676 continue; 2675 continue;
2677 2676
2678 gsize = data_size + sizeof(struct GNUNET_DHT_GetMessage); 2677 gsize = data_size + sizeof (struct GNUNET_DHT_GetMessage);
2679 gmsg = GNUNET_malloc(gsize); 2678 gmsg = GNUNET_malloc (gsize);
2680 gmsg->header.type = htons(GNUNET_MESSAGE_TYPE_DHT_GET_RESULT); 2679 gmsg->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_GET_RESULT);
2681 gmsg->header.size = htons(gsize); 2680 gmsg->header.size = htons (gsize);
2682 gmsg->type = put_msg->type; 2681 gmsg->type = put_msg->type;
2683 memcpy(&gmsg[1], &put_msg[1], data_size); 2682 memcpy (&gmsg[1], &put_msg[1], data_size);
2684 2683
2685 /* TODO: duplicate and reverse order of path_history? */ 2684 /* TODO: duplicate and reverse order of path_history? */
2686 send_reply_to_client (pos->client, &gmsg->header, msg_ctx); 2685 send_reply_to_client (pos->client, &gmsg->header, msg_ctx);
2687 GNUNET_free(gmsg); 2686 GNUNET_free (gmsg);
2688 } 2687 }
2689 } 2688 }
2690// GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "******************************************************** PUT END\n"); 2689// GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "******************************************************** PUT END\n");
@@ -2783,20 +2782,20 @@ get_forward_count (unsigned int hop_count, size_t target_replication)
2783 { 2782 {
2784 if (hop_count == 0) 2783 if (hop_count == 0)
2785 return kademlia_replication; 2784 return kademlia_replication;
2786 if (hop_count < log_of_network_size_estimate * 2.0) 2785 if (hop_count < log_of_network_size_estimate * 2.0)
2787 return 1; 2786 return 1;
2788 return 0; 2787 return 0;
2789 } 2788 }
2790 2789
2791 if (hop_count > log_of_network_size_estimate * 2.0) 2790 if (hop_count > log_of_network_size_estimate * 2.0)
2792 { 2791 {
2793 if (GNUNET_YES == paper_forwarding) 2792 if (GNUNET_YES == paper_forwarding)
2794 { 2793 {
2795 /* Once we have reached our ideal number of hops, don't stop forwarding! */ 2794 /* Once we have reached our ideal number of hops, don't stop forwarding! */
2796 return 1; 2795 return 1;
2797 } 2796 }
2798#if DEBUG_DHT 2797#if DEBUG_DHT
2799 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2798 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2800 "Hop count too high (est %f, lowest %d), NOT Forwarding request\n", 2799 "Hop count too high (est %f, lowest %d), NOT Forwarding request\n",
2801 log_of_network_size_estimate * 2.0, lowest_bucket); 2800 log_of_network_size_estimate * 2.0, lowest_bucket);
2802#endif 2801#endif
@@ -2893,7 +2892,7 @@ am_closest_peer (const GNUNET_HashCode * target,
2893 { 2892 {
2894 if (strict_kademlia != GNUNET_YES) /* Return that we at as close as any other peer */ 2893 if (strict_kademlia != GNUNET_YES) /* Return that we at as close as any other peer */
2895 return GNUNET_YES; 2894 return GNUNET_YES;
2896 if (distance (&pos->id.hashPubKey, target) < my_distance) /* Check all known peers, only return if we are the true closest */ 2895 if (distance (&pos->id.hashPubKey, target) < my_distance) /* Check all known peers, only return if we are the true closest */
2897 return GNUNET_NO; 2896 return GNUNET_NO;
2898 } 2897 }
2899 pos = pos->next; 2898 pos = pos->next;
@@ -2932,8 +2931,7 @@ select_peer (const GNUNET_HashCode * target,
2932 struct PeerInfo *chosen; 2931 struct PeerInfo *chosen;
2933 2932
2934 /** If we are doing kademlia routing (saves some cycles) */ 2933 /** If we are doing kademlia routing (saves some cycles) */
2935 if ( (strict_kademlia == GNUNET_YES) || 2934 if ((strict_kademlia == GNUNET_YES) || (hops >= log_of_network_size_estimate))
2936 (hops >= log_of_network_size_estimate) )
2937 { 2935 {
2938 /* greedy selection (closest peer that is not in bloomfilter) */ 2936 /* greedy selection (closest peer that is not in bloomfilter) */
2939 largest_distance = 0; 2937 largest_distance = 0;
@@ -2964,7 +2962,7 @@ select_peer (const GNUNET_HashCode * target,
2964 GNUNET_CONTAINER_bloomfilter_add (bloom, &chosen->id.hashPubKey); 2962 GNUNET_CONTAINER_bloomfilter_add (bloom, &chosen->id.hashPubKey);
2965 return chosen; 2963 return chosen;
2966 } 2964 }
2967 return NULL; /* no peer available or we are the closest */ 2965 return NULL; /* no peer available or we are the closest */
2968 } 2966 }
2969 2967
2970 2968
@@ -2986,14 +2984,13 @@ select_peer (const GNUNET_HashCode * target,
2986 pos = pos->next; 2984 pos = pos->next;
2987 } 2985 }
2988 } 2986 }
2989 if (count == 0) /* No peers to select from! */ 2987 if (count == 0) /* No peers to select from! */
2990 { 2988 {
2991 increment_stats ("# failed to select peer"); 2989 increment_stats ("# failed to select peer");
2992 return NULL; 2990 return NULL;
2993 } 2991 }
2994 /* Now actually choose a peer */ 2992 /* Now actually choose a peer */
2995 selected = 2993 selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, count);
2996 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, count);
2997 count = 0; 2994 count = 0;
2998 for (bc = lowest_bucket; bc < MAX_BUCKETS; bc++) 2995 for (bc = lowest_bucket; bc < MAX_BUCKETS; bc++)
2999 { 2996 {
@@ -3007,7 +3004,7 @@ select_peer (const GNUNET_HashCode * target,
3007 continue; /* Ignore bloomfiltered peers */ 3004 continue; /* Ignore bloomfiltered peers */
3008 } 3005 }
3009 if (0 == selected--) 3006 if (0 == selected--)
3010 return pos; 3007 return pos;
3011 pos = pos->next; 3008 pos = pos->next;
3012 } 3009 }
3013 } 3010 }
@@ -3105,10 +3102,10 @@ cache_response (struct DHT_MessageContext *msg_ctx)
3105 pos = record->head; 3102 pos = record->head;
3106 while (pos != NULL) 3103 while (pos != NULL)
3107 { 3104 {
3108 if ( (NULL != msg_ctx->peer) && 3105 if ((NULL != msg_ctx->peer) &&
3109 (0 == 3106 (0 ==
3110 memcmp (msg_ctx->peer, &pos->source, 3107 memcmp (msg_ctx->peer, &pos->source,
3111 sizeof (struct GNUNET_PeerIdentity))) ) 3108 sizeof (struct GNUNET_PeerIdentity))))
3112 break; /* Already have this peer in reply list! */ 3109 break; /* Already have this peer in reply list! */
3113 pos = pos->next; 3110 pos = pos->next;
3114 } 3111 }
@@ -3280,7 +3277,7 @@ route_message (const struct GNUNET_MessageHeader *msg,
3280 recent_req = GNUNET_CONTAINER_heap_peek (recent.minHeap); 3277 recent_req = GNUNET_CONTAINER_heap_peek (recent.minHeap);
3281 GNUNET_assert (recent_req != NULL); 3278 GNUNET_assert (recent_req != NULL);
3282 GNUNET_SCHEDULER_cancel (recent_req->remove_task); 3279 GNUNET_SCHEDULER_cancel (recent_req->remove_task);
3283 recent_req->remove_task = 3280 recent_req->remove_task =
3284 GNUNET_SCHEDULER_add_now (&remove_recent, recent_req); 3281 GNUNET_SCHEDULER_add_now (&remove_recent, recent_req);
3285 } 3282 }
3286 3283
@@ -3591,8 +3588,8 @@ malicious_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3591 "%s:%s Sending malicious PUT message with hash %s\n", my_short_id, 3588 "%s:%s Sending malicious PUT message with hash %s\n", my_short_id,
3592 "DHT", GNUNET_h2s (&key)); 3589 "DHT", GNUNET_h2s (&key));
3593 demultiplex_message (&put_message.header, &msg_ctx); 3590 demultiplex_message (&put_message.header, &msg_ctx);
3594 GNUNET_SCHEDULER_add_delayed (malicious_put_frequency, 3591 GNUNET_SCHEDULER_add_delayed (malicious_put_frequency, &malicious_put_task,
3595 &malicious_put_task, NULL); 3592 NULL);
3596} 3593}
3597 3594
3598 3595
@@ -3639,8 +3636,8 @@ malicious_get_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3639 "%s:%s Sending malicious GET message with hash %s\n", my_short_id, 3636 "%s:%s Sending malicious GET message with hash %s\n", my_short_id,
3640 "DHT", GNUNET_h2s (&key)); 3637 "DHT", GNUNET_h2s (&key));
3641 demultiplex_message (&get_message.header, &msg_ctx); 3638 demultiplex_message (&get_message.header, &msg_ctx);
3642 GNUNET_SCHEDULER_add_delayed (malicious_get_frequency, 3639 GNUNET_SCHEDULER_add_delayed (malicious_get_frequency, &malicious_get_task,
3643 &malicious_get_task, NULL); 3640 NULL);
3644} 3641}
3645#endif 3642#endif
3646 3643
@@ -3811,7 +3808,7 @@ handle_dht_local_route_request (void *cls, struct GNUNET_SERVER_Client *client,
3811 msg_ctx.path_history_len = 1; 3808 msg_ctx.path_history_len = 1;
3812 } 3809 }
3813 msg_ctx.network_size = log_of_network_size_estimate; 3810 msg_ctx.network_size = log_of_network_size_estimate;
3814 msg_ctx.peer = &my_identity; /* FIXME bart NULL? Fix doxygen? */ 3811 msg_ctx.peer = &my_identity; /* FIXME bart NULL? Fix doxygen? */
3815 msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 4; /* Make local routing a higher priority */ 3812 msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 4; /* Make local routing a higher priority */
3816 msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT; 3813 msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT;
3817 3814
@@ -4066,10 +4063,10 @@ handle_dht_p2p_route_request (void *cls, const struct GNUNET_PeerIdentity *peer,
4066 ntohl (incoming->outgoing_path_length) * 4063 ntohl (incoming->outgoing_path_length) *
4067 sizeof (struct GNUNET_PeerIdentity); 4064 sizeof (struct GNUNET_PeerIdentity);
4068 if (ntohs (message->size) != 4065 if (ntohs (message->size) !=
4069 (sizeof (struct GNUNET_DHT_P2PRouteMessage) + 4066 (sizeof (struct GNUNET_DHT_P2PRouteMessage) + ntohs (enc_msg->size) +
4070 ntohs (enc_msg->size) + path_size)) 4067 path_size))
4071 { 4068 {
4072 GNUNET_break_op(0); 4069 GNUNET_break_op (0);
4073 return GNUNET_YES; 4070 return GNUNET_YES;
4074 } 4071 }
4075 route_path = (char *) &incoming[1]; 4072 route_path = (char *) &incoming[1];
@@ -4524,8 +4521,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
4524 datacache = GNUNET_DATACACHE_create (cfg, "dhtcache"); 4521 datacache = GNUNET_DATACACHE_create (cfg, "dhtcache");
4525 GNUNET_SERVER_add_handlers (server, plugin_handlers); 4522 GNUNET_SERVER_add_handlers (server, plugin_handlers);
4526 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); 4523 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
4527 nse = GNUNET_NSE_connect (cfg, 4524 nse = GNUNET_NSE_connect (cfg, &update_network_size_estimate, NULL);
4528 &update_network_size_estimate, NULL);
4529 coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */ 4525 coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */
4530 DEFAULT_CORE_QUEUE_SIZE, /* queue size */ 4526 DEFAULT_CORE_QUEUE_SIZE, /* queue size */
4531 NULL, /* Closure passed to DHT functions */ 4527 NULL, /* Closure passed to DHT functions */
@@ -4587,8 +4583,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
4587 malicious_getter = GNUNET_YES; 4583 malicious_getter = GNUNET_YES;
4588 if (GNUNET_NO == 4584 if (GNUNET_NO ==
4589 GNUNET_CONFIGURATION_get_value_time (cfg, "DHT", 4585 GNUNET_CONFIGURATION_get_value_time (cfg, "DHT",
4590 "MALICIOUS_GET_FREQUENCY", 4586 "MALICIOUS_GET_FREQUENCY",
4591 &malicious_get_frequency)) 4587 &malicious_get_frequency))
4592 malicious_get_frequency = DEFAULT_MALICIOUS_GET_FREQUENCY; 4588 malicious_get_frequency = DEFAULT_MALICIOUS_GET_FREQUENCY;
4593 } 4589 }
4594 4590
@@ -4598,8 +4594,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
4598 malicious_putter = GNUNET_YES; 4594 malicious_putter = GNUNET_YES;
4599 if (GNUNET_NO == 4595 if (GNUNET_NO ==
4600 GNUNET_CONFIGURATION_get_value_time (cfg, "DHT", 4596 GNUNET_CONFIGURATION_get_value_time (cfg, "DHT",
4601 "MALICIOUS_PUT_FREQUENCY", 4597 "MALICIOUS_PUT_FREQUENCY",
4602 &malicious_put_frequency)) 4598 &malicious_put_frequency))
4603 malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY; 4599 malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY;
4604 } 4600 }
4605 4601
@@ -4721,7 +4717,8 @@ main (int argc, char *const *argv)
4721 int ret; 4717 int ret;
4722 4718
4723 recent.hashmap = GNUNET_CONTAINER_multihashmap_create (DHT_MAX_RECENT / 2); 4719 recent.hashmap = GNUNET_CONTAINER_multihashmap_create (DHT_MAX_RECENT / 2);
4724 recent.minHeap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 4720 recent.minHeap =
4721 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
4725 recent_find_peer_requests = 4722 recent_find_peer_requests =
4726 GNUNET_CONTAINER_multihashmap_create (MAX_BUCKETS / 8); 4723 GNUNET_CONTAINER_multihashmap_create (MAX_BUCKETS / 8);
4727 ret = 4724 ret =
@@ -4730,12 +4727,12 @@ main (int argc, char *const *argv)
4730 NULL)) ? 0 : 1; 4727 NULL)) ? 0 : 1;
4731 GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (recent.hashmap)); 4728 GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (recent.hashmap));
4732 GNUNET_CONTAINER_multihashmap_destroy (recent.hashmap); 4729 GNUNET_CONTAINER_multihashmap_destroy (recent.hashmap);
4733 recent.hashmap = NULL; 4730 recent.hashmap = NULL;
4734 GNUNET_assert (0 == GNUNET_CONTAINER_heap_get_size (recent.minHeap)); 4731 GNUNET_assert (0 == GNUNET_CONTAINER_heap_get_size (recent.minHeap));
4735 GNUNET_CONTAINER_heap_destroy (recent.minHeap); 4732 GNUNET_CONTAINER_heap_destroy (recent.minHeap);
4736 recent.minHeap = NULL; 4733 recent.minHeap = NULL;
4737 GNUNET_CONTAINER_multihashmap_destroy (recent_find_peer_requests); 4734 GNUNET_CONTAINER_multihashmap_destroy (recent_find_peer_requests);
4738 recent_find_peer_requests = NULL; 4735 recent_find_peer_requests = NULL;
4739 return ret; 4736 return ret;
4740} 4737}
4741 4738
diff --git a/src/dht/test_dht_twopeer_get_put.c b/src/dht/test_dht_twopeer_get_put.c
index 5ca70943a..ef491031c 100644
--- a/src/dht/test_dht_twopeer_get_put.c
+++ b/src/dht/test_dht_twopeer_get_put.c
@@ -30,7 +30,7 @@
30 * "straight line" topology. On notification that all peers have 30 * "straight line" topology. On notification that all peers have
31 * been properly connected, calls the do_get function which initiates 31 * been properly connected, calls the do_get function which initiates
32 * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get 32 * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get
33 * function starts, runs the do_put function to insert data at the first peer. 33 * function starts, runs the do_put function to insert data at the first peer.
34 * If the GET is successful, schedules finish_testing 34 * If the GET is successful, schedules finish_testing
35 * to stop the test and shut down peers. If GET is unsuccessful 35 * to stop the test and shut down peers. If GET is unsuccessful
36 * after GET_TIMEOUT seconds, prints an error message and shuts down 36 * after GET_TIMEOUT seconds, prints an error message and shuts down
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index 40a9f6276..1c15c6f60 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -445,9 +445,10 @@ GNUNET_FS_TEST_daemons_connect (struct GNUNET_FS_TestDaemon *daemon1,
445 ncc = GNUNET_malloc (sizeof (struct GNUNET_FS_TEST_ConnectContext)); 445 ncc = GNUNET_malloc (sizeof (struct GNUNET_FS_TEST_ConnectContext));
446 ncc->cont = cont; 446 ncc->cont = cont;
447 ncc->cont_cls = cont_cls; 447 ncc->cont_cls = cont_cls;
448 ncc->cc = GNUNET_TESTING_daemons_connect (daemon1->daemon, daemon2->daemon, timeout, 448 ncc->cc =
449 CONNECT_ATTEMPTS, GNUNET_YES, 449 GNUNET_TESTING_daemons_connect (daemon1->daemon, daemon2->daemon, timeout,
450 &notify_connection, ncc); 450 CONNECT_ATTEMPTS, GNUNET_YES,
451 &notify_connection, ncc);
451 return ncc; 452 return ncc;
452} 453}
453 454
diff --git a/src/fs/fs_test_lib.h b/src/fs/fs_test_lib.h
index 204d5b2ab..81125cafc 100644
--- a/src/fs/fs_test_lib.h
+++ b/src/fs/fs_test_lib.h
@@ -87,7 +87,8 @@ GNUNET_FS_TEST_daemons_connect (struct GNUNET_FS_TestDaemon *daemon1,
87 * @param cc operation to cancel 87 * @param cc operation to cancel
88 */ 88 */
89void 89void
90GNUNET_FS_TEST_daemons_connect_cancel (struct GNUNET_FS_TEST_ConnectContext *cc); 90GNUNET_FS_TEST_daemons_connect_cancel (struct GNUNET_FS_TEST_ConnectContext
91 *cc);
91 92
92 93
93/** 94/**
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index c22f8b20a..69fb75be6 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -336,11 +336,12 @@ get_latency (const struct GNUNET_TRANSPORT_ATS_Information *atsi)
336 if (ntohl (atsi->type) == GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR) 336 if (ntohl (atsi->type) == GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR)
337 { 337 {
338 static int once; 338 static int once;
339 if (! once) 339
340 { 340 if (!once)
341 once = 1; 341 {
342 GNUNET_break (0); 342 once = 1;
343 } 343 GNUNET_break (0);
344 }
344 /* how can we not have latency data? */ 345 /* how can we not have latency data? */
345 return GNUNET_TIME_UNIT_SECONDS; 346 return GNUNET_TIME_UNIT_SECONDS;
346 } 347 }
diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c
index 1f2119259..589abb3fb 100644
--- a/src/fs/test_fs_test_lib.c
+++ b/src/fs/test_fs_test_lib.c
@@ -52,10 +52,10 @@ static void
52do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 52do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
53{ 53{
54 if (NULL != cc) 54 if (NULL != cc)
55 { 55 {
56 GNUNET_FS_TEST_daemons_connect_cancel (cc); 56 GNUNET_FS_TEST_daemons_connect_cancel (cc);
57 cc = NULL; 57 cc = NULL;
58 } 58 }
59 if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) 59 if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
60 { 60 {
61 GNUNET_break (0); 61 GNUNET_break (0);
@@ -117,8 +117,8 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
117 } 117 }
118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
119 "Daemons started, will now try to connect them\n"); 119 "Daemons started, will now try to connect them\n");
120 cc = GNUNET_FS_TEST_daemons_connect (daemons[0], daemons[1], TIMEOUT, &do_publish, 120 cc = GNUNET_FS_TEST_daemons_connect (daemons[0], daemons[1], TIMEOUT,
121 NULL); 121 &do_publish, NULL);
122} 122}
123 123
124 124
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c
index bbf2534d2..3d6735cc4 100644
--- a/src/fs/test_gnunet_service_fs_migration.c
+++ b/src/fs/test_gnunet_service_fs_migration.c
@@ -59,12 +59,12 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
59{ 59{
60 struct GNUNET_TIME_Relative del; 60 struct GNUNET_TIME_Relative del;
61 char *fancy; 61 char *fancy;
62 62
63 if (NULL != cc) 63 if (NULL != cc)
64 { 64 {
65 GNUNET_FS_TEST_daemons_connect_cancel (cc); 65 GNUNET_FS_TEST_daemons_connect_cancel (cc);
66 cc = NULL; 66 cc = NULL;
67 } 67 }
68 GNUNET_FS_TEST_daemons_stop (2, daemons); 68 GNUNET_FS_TEST_daemons_stop (2, daemons);
69 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) 69 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
70 { 70 {
@@ -173,8 +173,8 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
173 } 173 }
174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
175 "Daemons started, will now try to connect them\n"); 175 "Daemons started, will now try to connect them\n");
176 cc = GNUNET_FS_TEST_daemons_connect (daemons[0], daemons[1], TIMEOUT, &do_publish, 176 cc = GNUNET_FS_TEST_daemons_connect (daemons[0], daemons[1], TIMEOUT,
177 NULL); 177 &do_publish, NULL);
178} 178}
179 179
180 180
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 26372cfa8..17b7ec181 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -57,10 +57,10 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
57 char *fancy; 57 char *fancy;
58 58
59 if (NULL != cc) 59 if (NULL != cc)
60 { 60 {
61 GNUNET_FS_TEST_daemons_connect_cancel (cc); 61 GNUNET_FS_TEST_daemons_connect_cancel (cc);
62 cc = NULL; 62 cc = NULL;
63 } 63 }
64 GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, daemons); 64 GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, daemons);
65 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) 65 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
66 { 66 {
@@ -128,8 +128,8 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
128 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)); 128 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
129 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 129 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
130 "Daemons started, will now try to connect them\n"); 130 "Daemons started, will now try to connect them\n");
131 cc = GNUNET_FS_TEST_daemons_connect (daemons[0], daemons[1], TIMEOUT, &do_publish, 131 cc = GNUNET_FS_TEST_daemons_connect (daemons[0], daemons[1], TIMEOUT,
132 NULL); 132 &do_publish, NULL);
133} 133}
134 134
135 135
diff --git a/src/include/gnunet_mesh_service_new.h b/src/include/gnunet_mesh_service_new.h
index f32bf28c5..6db406de3 100644
--- a/src/include/gnunet_mesh_service_new.h
+++ b/src/include/gnunet_mesh_service_new.h
@@ -116,11 +116,16 @@ struct GNUNET_MESH_MessageHandler
116 * @return initial tunnel context for the tunnel 116 * @return initial tunnel context for the tunnel
117 * (can be NULL -- that's not an error) 117 * (can be NULL -- that's not an error)
118 */ 118 */
119typedef void* (GNUNET_MESH_InboundTunnelNotificationHandler) ( 119typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls,
120 void *cls, 120 struct
121 struct GNUNET_MESH_Tunnel * tunnel, 121 GNUNET_MESH_Tunnel
122 const struct GNUNET_PeerIdentity * initiator, 122 * tunnel,
123 const struct GNUNET_TRANSPORT_ATS_Information * atsi); 123 const struct
124 GNUNET_PeerIdentity
125 * initiator,
126 const struct
127 GNUNET_TRANSPORT_ATS_Information
128 * atsi);
124 129
125 130
126/** 131/**
@@ -164,8 +169,7 @@ typedef uint32_t GNUNET_MESH_ApplicationType;
164 */ 169 */
165struct GNUNET_MESH_Handle * 170struct GNUNET_MESH_Handle *
166GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 171GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
167 unsigned int queue_size, 172 unsigned int queue_size, void *cls,
168 void *cls,
169 GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel, 173 GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel,
170 GNUNET_MESH_TunnelEndHandler cleaner, 174 GNUNET_MESH_TunnelEndHandler cleaner,
171 const struct GNUNET_MESH_MessageHandler *handlers, 175 const struct GNUNET_MESH_MessageHandler *handlers,
@@ -187,9 +191,9 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle);
187 * @param cls closure 191 * @param cls closure
188 * @param peer peer identity the tunnel stopped working with 192 * @param peer peer identity the tunnel stopped working with
189 */ 193 */
190typedef void (*GNUNET_MESH_PeerDisconnectHandler) ( 194typedef void (*GNUNET_MESH_PeerDisconnectHandler) (void *cls,
191 void *cls, 195 const struct
192 const struct GNUNET_PeerIdentity * peer); 196 GNUNET_PeerIdentity * peer);
193 197
194 198
195/** 199/**
@@ -200,10 +204,12 @@ typedef void (*GNUNET_MESH_PeerDisconnectHandler) (
200 * @param peer peer identity the tunnel was created to, NULL on timeout 204 * @param peer peer identity the tunnel was created to, NULL on timeout
201 * @param atsi performance data for the connection 205 * @param atsi performance data for the connection
202 */ 206 */
203typedef void (*GNUNET_MESH_PeerConnectHandler) ( 207typedef void (*GNUNET_MESH_PeerConnectHandler) (void *cls,
204 void *cls, 208 const struct GNUNET_PeerIdentity
205 const struct GNUNET_PeerIdentity * peer, 209 * peer,
206 const struct GNUNET_TRANSPORT_ATS_Information * atsi); 210 const struct
211 GNUNET_TRANSPORT_ATS_Information
212 * atsi);
207 213
208 214
209 215
@@ -218,8 +224,7 @@ typedef void (*GNUNET_MESH_PeerConnectHandler) (
218 * @param handler_cls closure for connect/disconnect handlers 224 * @param handler_cls closure for connect/disconnect handlers
219 */ 225 */
220struct GNUNET_MESH_Tunnel * 226struct GNUNET_MESH_Tunnel *
221GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, 227GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, void *tunnel_ctx,
222 void *tunnel_ctx,
223 GNUNET_MESH_PeerConnectHandler connect_handler, 228 GNUNET_MESH_PeerConnectHandler connect_handler,
224 GNUNET_MESH_PeerDisconnectHandler disconnect_handler, 229 GNUNET_MESH_PeerDisconnectHandler disconnect_handler,
225 void *handler_cls); 230 void *handler_cls);
@@ -297,8 +302,7 @@ struct GNUNET_MESH_TransmitHandle;
297 * memory); if NULL is returned, "notify" will NOT be called. 302 * memory); if NULL is returned, "notify" will NOT be called.
298 */ 303 */
299struct GNUNET_MESH_TransmitHandle * 304struct GNUNET_MESH_TransmitHandle *
300GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, 305GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int cork,
301 int cork,
302 uint32_t priority, 306 uint32_t priority,
303 struct GNUNET_TIME_Relative maxdelay, 307 struct GNUNET_TIME_Relative maxdelay,
304 const struct GNUNET_PeerIdentity *target, 308 const struct GNUNET_PeerIdentity *target,
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index 4f868e526..8b9472cdb 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -638,7 +638,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
638 638
639/** 639/**
640 * Handle to cancel a pending address lookup. 640 * Handle to cancel a pending address lookup.
641 */ 641 */
642struct GNUNET_TRANSPORT_AddressLookupContext; 642struct GNUNET_TRANSPORT_AddressLookupContext;
643 643
644 644
@@ -671,12 +671,14 @@ GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
671 * @param alc handle for the request to cancel 671 * @param alc handle for the request to cancel
672 */ 672 */
673void 673void
674GNUNET_TRANSPORT_address_lookup_cancel (struct GNUNET_TRANSPORT_AddressLookupContext *alc); 674GNUNET_TRANSPORT_address_lookup_cancel (struct
675 GNUNET_TRANSPORT_AddressLookupContext
676 *alc);
675 677
676 678
677/** 679/**
678 * Handle to cancel a pending address lookup. 680 * Handle to cancel a pending address lookup.
679 */ 681 */
680struct GNUNET_TRANSPORT_AddressLookupContext; 682struct GNUNET_TRANSPORT_AddressLookupContext;
681 683
682 684
@@ -706,7 +708,9 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle
706 * @param alc handle for the request to cancel 708 * @param alc handle for the request to cancel
707 */ 709 */
708void 710void
709GNUNET_TRANSPORT_peer_address_lookup_cancel (struct GNUNET_TRANSPORT_PeerAddressLookupContext *alc); 711GNUNET_TRANSPORT_peer_address_lookup_cancel (struct
712 GNUNET_TRANSPORT_PeerAddressLookupContext
713 *alc);
710 714
711 715
712/** 716/**
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index f31ff63ba..b30289ac0 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -661,8 +661,8 @@ is_client_subscribed (uint16_t message_type, struct MeshClient *c)
661{ 661{
662 GNUNET_HashCode hc; 662 GNUNET_HashCode hc;
663 663
664 GNUNET_CRYPTO_hash(&message_type, sizeof(uint16_t), &hc); 664 GNUNET_CRYPTO_hash (&message_type, sizeof (uint16_t), &hc);
665 return GNUNET_CONTAINER_multihashmap_contains(c->types, &hc); 665 return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc);
666} 666}
667 667
668 668
@@ -817,9 +817,8 @@ static int
817announce_application (void *cls, const GNUNET_HashCode * key, void *value) 817announce_application (void *cls, const GNUNET_HashCode * key, void *value)
818{ 818{
819 /* FIXME are hashes in multihash map equal on all aquitectures? */ 819 /* FIXME are hashes in multihash map equal on all aquitectures? */
820 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 820 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: putting in DHT %s\n",
821 "MESH: putting in DHT %s\n", 821 GNUNET_h2s_full (key));
822 GNUNET_h2s_full(key));
823 GNUNET_DHT_put (dht_handle, key, 10U, GNUNET_DHT_RO_RECORD_ROUTE, 822 GNUNET_DHT_put (dht_handle, key, 10U, GNUNET_DHT_RO_RECORD_ROUTE,
824 GNUNET_BLOCK_TYPE_TEST, sizeof (struct GNUNET_PeerIdentity), 823 GNUNET_BLOCK_TYPE_TEST, sizeof (struct GNUNET_PeerIdentity),
825 (const char *) &my_full_id, 824 (const char *) &my_full_id,
@@ -851,9 +850,8 @@ announce_applications (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
851 return; 850 return;
852 } 851 }
853 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Starting PUT for apps\n"); 852 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Starting PUT for apps\n");
854 GNUNET_CONTAINER_multihashmap_iterate(applications, 853 GNUNET_CONTAINER_multihashmap_iterate (applications, &announce_application,
855 &announce_application, 854 NULL);
856 NULL);
857 announce_applications_task = 855 announce_applications_task =
858 GNUNET_SCHEDULER_add_delayed (APP_ANNOUNCE_TIME, &announce_applications, 856 GNUNET_SCHEDULER_add_delayed (APP_ANNOUNCE_TIME, &announce_applications,
859 cls); 857 cls);
@@ -884,7 +882,7 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
884 &my_full_id.hashPubKey, /* Key to use */ 882 &my_full_id.hashPubKey, /* Key to use */
885 10U, /* Replication level */ 883 10U, /* Replication level */
886 GNUNET_DHT_RO_RECORD_ROUTE, /* DHT options */ 884 GNUNET_DHT_RO_RECORD_ROUTE, /* DHT options */
887 GNUNET_BLOCK_TYPE_TEST, /* Block type */ 885 GNUNET_BLOCK_TYPE_TEST, /* Block type */
888 0, /* Size of the data */ 886 0, /* Size of the data */
889 NULL, /* Data itself */ 887 NULL, /* Data itself */
890 GNUNET_TIME_absolute_get_forever (), /* Data expiration */ 888 GNUNET_TIME_absolute_get_forever (), /* Data expiration */
@@ -1682,7 +1680,7 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
1682 } 1680 }
1683 1681
1684 /* Message for us? */ 1682 /* Message for us? */
1685 if (0 == memcmp (&msg->oid, &my_full_id, sizeof(struct GNUNET_PeerIdentity))) 1683 if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct GNUNET_PeerIdentity)))
1686 { 1684 {
1687 struct GNUNET_MESH_PeerControl pc; 1685 struct GNUNET_MESH_PeerControl pc;
1688 1686
@@ -1772,7 +1770,7 @@ delete_tunnel_entry (void *cls, const GNUNET_HashCode * key, void *value)
1772static int 1770static int
1773deregister_app (void *cls, const GNUNET_HashCode * key, void *value) 1771deregister_app (void *cls, const GNUNET_HashCode * key, void *value)
1774{ 1772{
1775 GNUNET_CONTAINER_multihashmap_remove(applications, key, value); 1773 GNUNET_CONTAINER_multihashmap_remove (applications, key, value);
1776 return GNUNET_OK; 1774 return GNUNET_OK;
1777} 1775}
1778 1776
@@ -1880,12 +1878,10 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
1880 GNUNET_DHT_get_stop (peer_info->dhtget); 1878 GNUNET_DHT_get_stop (peer_info->dhtget);
1881 GNUNET_PEER_resolve (peer_info->id, &pi); 1879 GNUNET_PEER_resolve (peer_info->id, &pi);
1882 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ 1880 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */
1883 GNUNET_TIME_UNIT_FOREVER_REL, 1881 GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_BLOCK_TYPE_TEST, /* type */
1884 GNUNET_BLOCK_TYPE_TEST, /* type */ 1882 &pi.hashPubKey, /*key to search */
1885 &pi.hashPubKey, /*key to search */ 1883 4, /* replication level */
1886 4, /* replication level */ 1884 GNUNET_DHT_RO_RECORD_ROUTE, NULL, /* bloom filter */
1887 GNUNET_DHT_RO_RECORD_ROUTE,
1888 NULL, /* bloom filter */
1889 0, /* mutator */ 1885 0, /* mutator */
1890 NULL, /* xquery */ 1886 NULL, /* xquery */
1891 0, /* xquery bits */ 1887 0, /* xquery bits */
@@ -1966,7 +1962,7 @@ dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
1966 return; 1962 return;
1967 } 1963 }
1968 GNUNET_assert (NULL != t->client); 1964 GNUNET_assert (NULL != t->client);
1969 GNUNET_DHT_get_stop(t->client->dht_get_type); 1965 GNUNET_DHT_get_stop (t->client->dht_get_type);
1970 t->client->dht_get_type = NULL; 1966 t->client->dht_get_type = NULL;
1971 peer_info = get_peer_info (pi); 1967 peer_info = get_peer_info (pi);
1972 GNUNET_CONTAINER_multihashmap_put (t->peers, &pi->hashPubKey, peer_info, 1968 GNUNET_CONTAINER_multihashmap_put (t->peers, &pi->hashPubKey, peer_info,
@@ -1976,13 +1972,9 @@ dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
1976 /* we don't have a route to the peer, let's try a direct lookup */ 1972 /* we don't have a route to the peer, let's try a direct lookup */
1977 if (NULL == peer_info->dhtget) 1973 if (NULL == peer_info->dhtget)
1978 { 1974 {
1979 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ 1975 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */
1980 GNUNET_TIME_UNIT_FOREVER_REL, 1976 GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_BLOCK_TYPE_TEST, &pi->hashPubKey, 10U, /* replication level */
1981 GNUNET_BLOCK_TYPE_TEST, 1977 GNUNET_DHT_RO_RECORD_ROUTE, NULL, /* bloom filter */
1982 &pi->hashPubKey,
1983 10U, /* replication level */
1984 GNUNET_DHT_RO_RECORD_ROUTE,
1985 NULL, /* bloom filter */
1986 0, /* mutator */ 1978 0, /* mutator */
1987 NULL, /* xquery */ 1979 NULL, /* xquery */
1988 0, /* xquery bits */ 1980 0, /* xquery bits */
@@ -2050,8 +2042,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
2050 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: matching client found\n"); 2042 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: matching client found\n");
2051 if (NULL != c->tunnels) 2043 if (NULL != c->tunnels)
2052 { 2044 {
2053 GNUNET_CONTAINER_multihashmap_iterate (c->tunnels, 2045 GNUNET_CONTAINER_multihashmap_iterate (c->tunnels, &delete_tunnel_entry,
2054 &delete_tunnel_entry,
2055 c); 2046 c);
2056 GNUNET_CONTAINER_multihashmap_destroy (c->tunnels); 2047 GNUNET_CONTAINER_multihashmap_destroy (c->tunnels);
2057 } 2048 }
@@ -2059,19 +2050,19 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
2059 /* deregister clients applications */ 2050 /* deregister clients applications */
2060 if (NULL != c->apps) 2051 if (NULL != c->apps)
2061 { 2052 {
2062 GNUNET_CONTAINER_multihashmap_iterate(c->apps, &deregister_app, NULL); 2053 GNUNET_CONTAINER_multihashmap_iterate (c->apps, &deregister_app, NULL);
2063 GNUNET_CONTAINER_multihashmap_destroy(c->apps); 2054 GNUNET_CONTAINER_multihashmap_destroy (c->apps);
2064 } 2055 }
2065 if (0 == GNUNET_CONTAINER_multihashmap_size(applications) && 2056 if (0 == GNUNET_CONTAINER_multihashmap_size (applications) &&
2066 GNUNET_SCHEDULER_NO_TASK != announce_applications_task) 2057 GNUNET_SCHEDULER_NO_TASK != announce_applications_task)
2067 { 2058 {
2068 GNUNET_SCHEDULER_cancel (announce_applications_task); 2059 GNUNET_SCHEDULER_cancel (announce_applications_task);
2069 announce_applications_task = GNUNET_SCHEDULER_NO_TASK; 2060 announce_applications_task = GNUNET_SCHEDULER_NO_TASK;
2070 } 2061 }
2071 if (NULL != c->types) 2062 if (NULL != c->types)
2072 GNUNET_CONTAINER_multihashmap_destroy(c->types); 2063 GNUNET_CONTAINER_multihashmap_destroy (c->types);
2073 if (NULL != c->dht_get_type) 2064 if (NULL != c->dht_get_type)
2074 GNUNET_DHT_get_stop(c->dht_get_type); 2065 GNUNET_DHT_get_stop (c->dht_get_type);
2075 GNUNET_CONTAINER_DLL_remove (clients, clients_tail, c); 2066 GNUNET_CONTAINER_DLL_remove (clients, clients_tail, c);
2076 next = c->next; 2067 next = c->next;
2077 GNUNET_free (c); 2068 GNUNET_free (c);
@@ -2126,27 +2117,21 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client,
2126 GNUNET_MESH_ApplicationType at; 2117 GNUNET_MESH_ApplicationType at;
2127 GNUNET_HashCode hc; 2118 GNUNET_HashCode hc;
2128 2119
2129 c->apps = GNUNET_CONTAINER_multihashmap_create(napps); 2120 c->apps = GNUNET_CONTAINER_multihashmap_create (napps);
2130 for (i = 0; i < napps; i++) 2121 for (i = 0; i < napps; i++)
2131 { 2122 {
2132 at = ntohl(a[i]); 2123 at = ntohl (a[i]);
2133 GNUNET_CRYPTO_hash(&at, sizeof(at), &hc); 2124 GNUNET_CRYPTO_hash (&at, sizeof (at), &hc);
2134 /* store in clients hashmap */ 2125 /* store in clients hashmap */
2135 GNUNET_CONTAINER_multihashmap_put( 2126 GNUNET_CONTAINER_multihashmap_put (c->apps, &hc, c,
2136 c->apps, 2127 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2137 &hc,
2138 c,
2139 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2140 /* store in global hashmap, for announcements */ 2128 /* store in global hashmap, for announcements */
2141 GNUNET_CONTAINER_multihashmap_put( 2129 GNUNET_CONTAINER_multihashmap_put (applications, &hc, c,
2142 applications, 2130 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2143 &hc,
2144 c,
2145 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2146 } 2131 }
2147 if (GNUNET_SCHEDULER_NO_TASK == announce_applications_task) 2132 if (GNUNET_SCHEDULER_NO_TASK == announce_applications_task)
2148 announce_applications_task = GNUNET_SCHEDULER_add_now ( 2133 announce_applications_task =
2149 &announce_applications, NULL); 2134 GNUNET_SCHEDULER_add_now (&announce_applications, NULL);
2150 2135
2151 } 2136 }
2152 if (ntypes > 0) 2137 if (ntypes > 0)
@@ -2154,24 +2139,19 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client,
2154 uint16_t u16; 2139 uint16_t u16;
2155 GNUNET_HashCode hc; 2140 GNUNET_HashCode hc;
2156 2141
2157 t = (uint16_t *) &a[napps]; 2142 t = (uint16_t *) & a[napps];
2158 c->types = GNUNET_CONTAINER_multihashmap_create(ntypes); 2143 c->types = GNUNET_CONTAINER_multihashmap_create (ntypes);
2159 for (i =0; i < ntypes; i++) 2144 for (i = 0; i < ntypes; i++)
2160 { 2145 {
2161 u16 = ntohs(t[i]); 2146 u16 = ntohs (t[i]);
2162 GNUNET_CRYPTO_hash(&u16, sizeof(u16), &hc); 2147 GNUNET_CRYPTO_hash (&u16, sizeof (u16), &hc);
2148
2163 /* store in clients hashmap */ 2149 /* store in clients hashmap */
2164 GNUNET_CONTAINER_multihashmap_put( 2150 GNUNET_CONTAINER_multihashmap_put (c->types, &hc, c,
2165 c->types, 2151 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2166 &hc,
2167 c,
2168 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2169 /* store in global hashmap */ 2152 /* store in global hashmap */
2170 GNUNET_CONTAINER_multihashmap_put( 2153 GNUNET_CONTAINER_multihashmap_put (types, &hc, c,
2171 types, 2154 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2172 &hc,
2173 c,
2174 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2175 } 2155 }
2176 } 2156 }
2177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2157 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2383,9 +2363,7 @@ handle_local_connect_add (void *cls, struct GNUNET_SERVER_Client *client,
2383 /* Start DHT search if needed */ 2363 /* Start DHT search if needed */
2384 if (MESH_PEER_READY != peer_info->state && NULL == peer_info->dhtget) 2364 if (MESH_PEER_READY != peer_info->state && NULL == peer_info->dhtget)
2385 { 2365 {
2386 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL, 2366 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_BLOCK_TYPE_TEST, &peer_msg->peer.hashPubKey, 4, /* replication level */
2387 GNUNET_BLOCK_TYPE_TEST,
2388 &peer_msg->peer.hashPubKey, 4, /* replication level */
2389 GNUNET_DHT_RO_RECORD_ROUTE, NULL, /* bloom filter */ 2367 GNUNET_DHT_RO_RECORD_ROUTE, NULL, /* bloom filter */
2390 0, /* mutator */ 2368 0, /* mutator */
2391 NULL, /* xquery */ 2369 NULL, /* xquery */
@@ -2517,26 +2495,27 @@ handle_local_connect_by_type (void *cls, struct GNUNET_SERVER_Client *client,
2517 type = ntohl (connect_msg->type); 2495 type = ntohl (connect_msg->type);
2518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: type requested: %u\n", type); 2496 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: type requested: %u\n", type);
2519 GNUNET_CRYPTO_hash (&type, sizeof (GNUNET_MESH_ApplicationType), &hash); 2497 GNUNET_CRYPTO_hash (&type, sizeof (GNUNET_MESH_ApplicationType), &hash);
2520 if (GNUNET_CONTAINER_multihashmap_contains(applications, &hash) == GNUNET_YES) 2498 if (GNUNET_CONTAINER_multihashmap_contains (applications, &hash) ==
2499 GNUNET_YES)
2521 { 2500 {
2522 /* Yes! Fast forward, add ourselves to the tunnel and send the 2501 /* Yes! Fast forward, add ourselves to the tunnel and send the
2523 * good news to the client 2502 * good news to the client
2524 */ 2503 */
2525 struct GNUNET_MESH_PeerControl pc; 2504 struct GNUNET_MESH_PeerControl pc;
2526 2505
2527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: available locally\n"); 2506 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: available locally\n");
2528 pc.peer = my_full_id; 2507 pc.peer = my_full_id;
2529 GNUNET_CONTAINER_multihashmap_put (t->peers, &pc.peer.hashPubKey, 2508 GNUNET_CONTAINER_multihashmap_put (t->peers, &pc.peer.hashPubKey,
2530 get_peer_info (&pc.peer), 2509 get_peer_info (&pc.peer),
2531 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 2510 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
2532 pc.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); 2511 pc.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl));
2533 pc.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD); 2512 pc.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD);
2534 pc.tunnel_id = htonl (t->local_tid); 2513 pc.tunnel_id = htonl (t->local_tid);
2535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: notifying client\n"); 2514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: notifying client\n");
2536 GNUNET_SERVER_notification_context_unicast (nc, /* context */ 2515 GNUNET_SERVER_notification_context_unicast (nc, /* context */
2537 client, /* dest */ 2516 client, /* dest */
2538 &pc.header, /* msg */ 2517 &pc.header, /* msg */
2539 GNUNET_NO); /* can drop? */ 2518 GNUNET_NO); /* can drop? */
2540 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Done\n"); 2519 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Done\n");
2541 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2520 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2542 return; 2521 return;
@@ -2546,22 +2525,13 @@ handle_local_connect_by_type (void *cls, struct GNUNET_SERVER_Client *client,
2546 { 2525 {
2547 GNUNET_DHT_get_stop (c->dht_get_type); 2526 GNUNET_DHT_get_stop (c->dht_get_type);
2548 } 2527 }
2549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2528 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: looking in DHT for %s\n",
2550 "MESH: looking in DHT for %s\n", 2529 GNUNET_h2s_full (&hash));
2551 GNUNET_h2s_full(&hash));
2552 c->dht_get_type = 2530 c->dht_get_type =
2553 GNUNET_DHT_get_start (dht_handle, 2531 GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL,
2554 GNUNET_TIME_UNIT_FOREVER_REL, 2532 GNUNET_BLOCK_TYPE_TEST, &hash, 10U,
2555 GNUNET_BLOCK_TYPE_TEST, 2533 GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0, NULL, 0,
2556 &hash, 2534 &dht_get_type_handler, t);
2557 10U,
2558 GNUNET_DHT_RO_RECORD_ROUTE,
2559 NULL,
2560 0,
2561 NULL,
2562 0,
2563 &dht_get_type_handler,
2564 t);
2565 2535
2566 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2536 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2567 return; 2537 return;
@@ -2639,7 +2609,7 @@ handle_local_unicast (void *cls, struct GNUNET_SERVER_Client *client,
2639 /* Work around const limitation */ 2609 /* Work around const limitation */
2640 memcpy (&copy, data_msg, sizeof (struct GNUNET_MESH_Unicast)); 2610 memcpy (&copy, data_msg, sizeof (struct GNUNET_MESH_Unicast));
2641 copy.oid = my_full_id; 2611 copy.oid = my_full_id;
2642 copy.tid = htonl(t->id.tid); 2612 copy.tid = htonl (t->id.tid);
2643 handle_mesh_data_unicast (NULL, &my_full_id, &copy.header, NULL); 2613 handle_mesh_data_unicast (NULL, &my_full_id, &copy.header, NULL);
2644 return; 2614 return;
2645 } 2615 }
@@ -2858,7 +2828,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2858 { 2828 {
2859 for (c = clients; NULL != c; c = c->next) 2829 for (c = clients; NULL != c; c = c->next)
2860 if (NULL != c->dht_get_type) 2830 if (NULL != c->dht_get_type)
2861 GNUNET_DHT_get_stop(c->dht_get_type); 2831 GNUNET_DHT_get_stop (c->dht_get_type);
2862 GNUNET_DHT_disconnect (dht_handle); 2832 GNUNET_DHT_disconnect (dht_handle);
2863 dht_handle = NULL; 2833 dht_handle = NULL;
2864 } 2834 }
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index 615593621..8476be396 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -921,4 +921,4 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle)
921 GNUNET_free (handle); 921 GNUNET_free (handle);
922} 922}
923 923
924/* end of mesh_api.c */ \ No newline at end of file 924/* end of mesh_api.c */
diff --git a/src/mesh/mesh_api_new.c b/src/mesh/mesh_api_new.c
index 80228c80a..38efd8eb3 100644
--- a/src/mesh/mesh_api_new.c
+++ b/src/mesh/mesh_api_new.c
@@ -773,7 +773,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h,
773 GNUNET_PEER_Id id; 773 GNUNET_PEER_Id id;
774 uint16_t size; 774 uint16_t size;
775 775
776 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "mesh: processig peer event\n"); 776 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: processig peer event\n");
777 size = ntohs (msg->header.size); 777 size = ntohs (msg->header.size);
778 if (size != sizeof (struct GNUNET_MESH_PeerControl)) 778 if (size != sizeof (struct GNUNET_MESH_PeerControl))
779 { 779 {
@@ -789,9 +789,9 @@ process_peer_event (struct GNUNET_MESH_Handle *h,
789 id = GNUNET_PEER_search (&msg->peer); 789 id = GNUNET_PEER_search (&msg->peer);
790 if ((p = retrieve_peer (t, id)) == NULL) 790 if ((p = retrieve_peer (t, id)) == NULL)
791 p = add_peer_to_tunnel (t, &msg->peer); 791 p = add_peer_to_tunnel (t, &msg->peer);
792 if (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD == ntohs(msg->header.type)) 792 if (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD == ntohs (msg->header.type))
793 { 793 {
794 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "mesh: adding peer\n"); 794 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: adding peer\n");
795 if (NULL != t->connect_handler) 795 if (NULL != t->connect_handler)
796 { 796 {
797 atsi.type = 0; 797 atsi.type = 0;
@@ -802,7 +802,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h,
802 } 802 }
803 else 803 else
804 { 804 {
805 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "mesh: removing peer\n"); 805 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: removing peer\n");
806 if (NULL != t->disconnect_handler && p->connected) 806 if (NULL != t->disconnect_handler && p->connected)
807 { 807 {
808 t->disconnect_handler (t->cls, &msg->peer); 808 t->disconnect_handler (t->cls, &msg->peer);
@@ -810,7 +810,7 @@ process_peer_event (struct GNUNET_MESH_Handle *h,
810 remove_peer_from_tunnel (p); 810 remove_peer_from_tunnel (p);
811 GNUNET_free (p); 811 GNUNET_free (p);
812 } 812 }
813 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "mesh: processing peer event END\n"); 813 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: processing peer event END\n");
814} 814}
815 815
816 816
@@ -1165,12 +1165,13 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1165 apps = (GNUNET_MESH_ApplicationType *) &msg[1]; 1165 apps = (GNUNET_MESH_ApplicationType *) &msg[1];
1166 for (napps = 0; napps < h->n_applications; napps++) 1166 for (napps = 0; napps < h->n_applications; napps++)
1167 { 1167 {
1168 apps[napps] = htonl(h->applications[napps]); 1168 apps[napps] = htonl (h->applications[napps]);
1169 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "mesh: app %u\n", h->applications[napps]); 1169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: app %u\n",
1170 h->applications[napps]);
1170 } 1171 }
1171 types = (uint16_t *) &apps[napps]; 1172 types = (uint16_t *) & apps[napps];
1172 for (ntypes = 0; ntypes < h->n_handlers; ntypes++) 1173 for (ntypes = 0; ntypes < h->n_handlers; ntypes++)
1173 types[ntypes] = htons(h->message_handlers[ntypes].type); 1174 types[ntypes] = htons (h->message_handlers[ntypes].type);
1174 msg->applications = htons (napps); 1175 msg->applications = htons (napps);
1175 msg->types = htons (ntypes); 1176 msg->types = htons (ntypes);
1176#if DEBUG 1177#if DEBUG
diff --git a/src/mesh/test_mesh_local_1.c b/src/mesh/test_mesh_local_1.c
index 4e8d0b78e..5c45f2895 100644
--- a/src/mesh/test_mesh_local_1.c
+++ b/src/mesh/test_mesh_local_1.c
@@ -107,9 +107,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
107 */ 107 */
108static int 108static int
109data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, 109data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
110 const struct GNUNET_PeerIdentity *sender, 110 const struct GNUNET_PeerIdentity *sender,
111 const struct GNUNET_MessageHeader *message, 111 const struct GNUNET_MessageHeader *message,
112 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 112 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
113{ 113{
114 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n"); 114 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
115 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 115 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -140,7 +140,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
140 if (id != 1) 140 if (id != 1)
141 { 141 {
142 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 142 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
143 "test: received incoming tunnel on peer 2\n"); 143 "test: received incoming tunnel on peer 2\n");
144 result = GNUNET_SYSERR; 144 result = GNUNET_SYSERR;
145 } 145 }
146 return NULL; 146 return NULL;
@@ -157,8 +157,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
157 * with the tunnel is stored 157 * with the tunnel is stored
158 */ 158 */
159static void 159static void
160inbound_end (void *cls, 160inbound_end (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
161 const struct GNUNET_MESH_Tunnel * tunnel,
162 void *tunnel_ctx) 161 void *tunnel_ctx)
163{ 162{
164 unsigned int id = *(unsigned int *) cls; 163 unsigned int id = *(unsigned int *) cls;
@@ -167,7 +166,7 @@ inbound_end (void *cls,
167 if (id != 1) 166 if (id != 1)
168 { 167 {
169 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 168 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
170 "test: received closing tunnel on peer 2\n"); 169 "test: received closing tunnel on peer 2\n");
171 result = GNUNET_SYSERR; 170 result = GNUNET_SYSERR;
172 } 171 }
173} 172}
@@ -179,13 +178,12 @@ inbound_end (void *cls,
179 * @param cls closure 178 * @param cls closure
180 * @param peer peer identity the tunnel stopped working with 179 * @param peer peer identity the tunnel stopped working with
181 */ 180 */
182static void peer_conected ( 181static void
183 void *cls, 182peer_conected (void *cls, const struct GNUNET_PeerIdentity *peer,
184 const struct GNUNET_PeerIdentity * peer, 183 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
185 const struct GNUNET_TRANSPORT_ATS_Information * atsi)
186{ 184{
187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n"); 185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n");
188 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL); 186 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL);
189} 187}
190 188
191 189
@@ -196,9 +194,8 @@ static void peer_conected (
196 * @param peer peer identity the tunnel was created to, NULL on timeout 194 * @param peer peer identity the tunnel was created to, NULL on timeout
197 * @param atsi performance data for the connection 195 * @param atsi performance data for the connection
198 */ 196 */
199static void peer_disconnected ( 197static void
200 void *cls, 198peer_disconnected (void *cls, const struct GNUNET_PeerIdentity *peer)
201 const struct GNUNET_PeerIdentity * peer)
202{ 199{
203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n"); 200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n");
204} 201}
@@ -225,7 +222,7 @@ static struct GNUNET_MESH_MessageHandler handlers2[] = { {NULL, 0, 0} };
225static void 222static void
226do_find (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 223do_find (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
227{ 224{
228 GNUNET_MESH_peer_request_connect_by_type(t, 1); 225 GNUNET_MESH_peer_request_connect_by_type (t, 1);
229} 226}
230 227
231 228
@@ -265,12 +262,9 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
265 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: YAY! CONNECTED TO MESH :D\n"); 262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: YAY! CONNECTED TO MESH :D\n");
266 } 263 }
267 264
268 t = GNUNET_MESH_tunnel_create (mesh_peer_2, 265 t = GNUNET_MESH_tunnel_create (mesh_peer_2, NULL, &peer_conected,
269 NULL, 266 &peer_disconnected, (void *) &two);
270 &peer_conected, 267 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_find, NULL);
271 &peer_disconnected,
272 (void *) &two);
273 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &do_find, NULL);
274} 268}
275 269
276 270
diff --git a/src/mesh/test_mesh_local_2.c b/src/mesh/test_mesh_local_2.c
index 9da611bf4..b29921dd3 100644
--- a/src/mesh/test_mesh_local_2.c
+++ b/src/mesh/test_mesh_local_2.c
@@ -80,7 +80,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
80static void 80static void
81do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 81do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
82{ 82{
83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n"); 83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n");
84 if (0 != test_task) 84 if (0 != test_task)
85 { 85 {
86 GNUNET_SCHEDULER_cancel (test_task); 86 GNUNET_SCHEDULER_cancel (test_task);
@@ -105,9 +105,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
105 */ 105 */
106static int 106static int
107data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, 107data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
108 const struct GNUNET_PeerIdentity *sender, 108 const struct GNUNET_PeerIdentity *sender,
109 const struct GNUNET_MessageHeader *message, 109 const struct GNUNET_MessageHeader *message,
110 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 110 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
111{ 111{
112 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n"); 112 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
113 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 113 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -138,7 +138,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
138 if (id != 1) 138 if (id != 1)
139 { 139 {
140 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 140 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
141 "test: received incoming tunnel on peer 2\n"); 141 "test: received incoming tunnel on peer 2\n");
142 result = GNUNET_SYSERR; 142 result = GNUNET_SYSERR;
143 } 143 }
144 return NULL; 144 return NULL;
@@ -155,8 +155,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
155 * with the tunnel is stored 155 * with the tunnel is stored
156 */ 156 */
157static void 157static void
158inbound_end (void *cls, 158inbound_end (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
159 const struct GNUNET_MESH_Tunnel * tunnel,
160 void *tunnel_ctx) 159 void *tunnel_ctx)
161{ 160{
162 unsigned int id = (unsigned int) cls; 161 unsigned int id = (unsigned int) cls;
@@ -165,7 +164,7 @@ inbound_end (void *cls,
165 if (id != 1) 164 if (id != 1)
166 { 165 {
167 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 166 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
168 "test: received closing tunnel on peer 2\n"); 167 "test: received closing tunnel on peer 2\n");
169 result = GNUNET_SYSERR; 168 result = GNUNET_SYSERR;
170 } 169 }
171} 170}
@@ -177,12 +176,11 @@ inbound_end (void *cls,
177 * @param cls closure 176 * @param cls closure
178 * @param peer peer identity the tunnel stopped working with 177 * @param peer peer identity the tunnel stopped working with
179 */ 178 */
180static void peer_conected ( 179static void
181 void *cls, 180peer_conected (void *cls, const struct GNUNET_PeerIdentity *peer)
182 const struct GNUNET_PeerIdentity * peer)
183{ 181{
184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n"); 182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n");
185 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL); 183 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL);
186} 184}
187 185
188 186
@@ -193,10 +191,9 @@ static void peer_conected (
193 * @param peer peer identity the tunnel was created to, NULL on timeout 191 * @param peer peer identity the tunnel was created to, NULL on timeout
194 * @param atsi performance data for the connection 192 * @param atsi performance data for the connection
195 */ 193 */
196static void peer_disconnected ( 194static void
197 void *cls, 195peer_disconnected (void *cls, const struct GNUNET_PeerIdentity *peer,
198 const struct GNUNET_PeerIdentity * peer, 196 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
199 const struct GNUNET_TRANSPORT_ATS_Information * atsi)
200{ 197{
201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n"); 198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n");
202} 199}
@@ -265,15 +262,12 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
265 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: YAY! CONNECTED TO MESH :D\n"); 262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: YAY! CONNECTED TO MESH :D\n");
266 } 263 }
267 264
268 t = GNUNET_MESH_tunnel_create (mesh_peer_2, 265 t = GNUNET_MESH_tunnel_create (mesh_peer_2, NULL, &peer_conected,
269 NULL, 266 &peer_disconnected, (void *) 2);
270 &peer_conected, 267 GNUNET_MESH_peer_request_connect_by_type (t, 1);
271 &peer_disconnected, 268 test_task =
272 (void *) 2); 269 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
273 GNUNET_MESH_peer_request_connect_by_type(t, 1); 270 &do_connect_peer_1, cfg);
274 test_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS,
275 &do_connect_peer_1,
276 cfg);
277} 271}
278 272
279 273
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index eaaac0c38..00ab22993 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -158,7 +158,7 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
158 GNUNET_PEERINFO_disconnect (peerinfo); 158 GNUNET_PEERINFO_disconnect (peerinfo);
159 return; 159 return;
160 } 160 }
161 if ( (be_quiet) || (NULL == hello) ) 161 if ((be_quiet) || (NULL == hello))
162 { 162 {
163 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); 163 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
164 printf ("%s\n", (const char *) &enc); 164 printf ("%s\n", (const char *) &enc);
diff --git a/src/testing/test_testing_connect.c b/src/testing/test_testing_connect.c
index fd14f76be..a31449a71 100644
--- a/src/testing/test_testing_connect.c
+++ b/src/testing/test_testing_connect.c
@@ -116,8 +116,8 @@ my_cb2 (void *cls, const struct GNUNET_PeerIdentity *id,
116 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Daemon `%s' started.\n", 116 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Daemon `%s' started.\n",
117 GNUNET_i2s (id)); 117 GNUNET_i2s (id));
118#endif 118#endif
119 cc = GNUNET_TESTING_daemons_connect (d1, d2, TIMEOUT, CONNECT_ATTEMPTS, GNUNET_YES, 119 cc = GNUNET_TESTING_daemons_connect (d1, d2, TIMEOUT, CONNECT_ATTEMPTS,
120 &my_connect_complete, NULL); 120 GNUNET_YES, &my_connect_complete, NULL);
121} 121}
122 122
123 123
diff --git a/src/testing/test_testing_reconnect.c b/src/testing/test_testing_reconnect.c
index 36675012f..d12e29e78 100644
--- a/src/testing/test_testing_reconnect.c
+++ b/src/testing/test_testing_reconnect.c
@@ -146,8 +146,8 @@ my_cb2 (void *cls, const struct GNUNET_PeerIdentity *id,
146 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Daemon `%s' started.\n", 146 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Daemon `%s' started.\n",
147 GNUNET_i2s (id)); 147 GNUNET_i2s (id));
148#endif 148#endif
149 cc = GNUNET_TESTING_daemons_connect (d1, d2, TIMEOUT, CONNECT_ATTEMPTS, GNUNET_YES, 149 cc = GNUNET_TESTING_daemons_connect (d1, d2, TIMEOUT, CONNECT_ATTEMPTS,
150 &my_connect_complete, NULL); 150 GNUNET_YES, &my_connect_complete, NULL);
151} 151}
152 152
153 153
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 65446eb77..335457dcb 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -88,6 +88,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
88{ 88{
89 struct GNUNET_TESTING_Daemon *daemon = cls; 89 struct GNUNET_TESTING_Daemon *daemon = cls;
90 int msize; 90 int msize;
91
91#if EMPTY_HACK 92#if EMPTY_HACK
92 int empty; 93 int empty;
93 94
@@ -1870,7 +1871,8 @@ notify_connect_result (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1870 else if (ctx->connect_attempts > 0) 1871 else if (ctx->connect_attempts > 0)
1871 { 1872 {
1872 ctx->d1core_ready = GNUNET_NO; 1873 ctx->d1core_ready = GNUNET_NO;
1873 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&reattempt_daemons_connect, ctx); 1874 ctx->timeout_task =
1875 GNUNET_SCHEDULER_add_now (&reattempt_daemons_connect, ctx);
1874 return; 1876 return;
1875 } 1877 }
1876 else 1878 else
@@ -1907,12 +1909,12 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
1907 if (0 != memcmp (&ctx->d2->id, peer, sizeof (struct GNUNET_PeerIdentity))) 1909 if (0 != memcmp (&ctx->d2->id, peer, sizeof (struct GNUNET_PeerIdentity)))
1908 return; 1910 return;
1909 ctx->connected = GNUNET_YES; 1911 ctx->connected = GNUNET_YES;
1910 ctx->distance = 0; /* FIXME: distance */ 1912 ctx->distance = 0; /* FIXME: distance */
1911 if (ctx->hello_send_task != GNUNET_SCHEDULER_NO_TASK) 1913 if (ctx->hello_send_task != GNUNET_SCHEDULER_NO_TASK)
1912 { 1914 {
1913 GNUNET_SCHEDULER_cancel (ctx->hello_send_task); 1915 GNUNET_SCHEDULER_cancel (ctx->hello_send_task);
1914 ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK; 1916 ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK;
1915 } 1917 }
1916 GNUNET_SCHEDULER_cancel (ctx->timeout_task); 1918 GNUNET_SCHEDULER_cancel (ctx->timeout_task);
1917 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx); 1919 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
1918} 1920}
@@ -2130,74 +2132,72 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer,
2130 return; 2132 return;
2131 } 2133 }
2132 if (peer != NULL) 2134 if (peer != NULL)
2133 return; /* ignore other peers */ 2135 return; /* ignore other peers */
2134 /* peer == NULL: End of iteration over peers */ 2136 /* peer == NULL: End of iteration over peers */
2135
2136 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == ctx->timeout_task);
2137 if (ctx->connected == GNUNET_YES)
2138 {
2139 ctx->timeout_task =
2140 GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
2141 return;
2142 }
2143 2137
2144 /* Peer not already connected, need to schedule connect request! */ 2138 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == ctx->timeout_task);
2145 if (ctx->d1core == NULL) 2139 if (ctx->connected == GNUNET_YES)
2146 { 2140 {
2141 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
2142 return;
2143 }
2144
2145 /* Peer not already connected, need to schedule connect request! */
2146 if (ctx->d1core == NULL)
2147 {
2147#if DEBUG_TESTING 2148#if DEBUG_TESTING
2148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2149 "Peers are NOT connected, connecting to core!\n"); 2150 "Peers are NOT connected, connecting to core!\n");
2150#endif 2151#endif
2151 ctx->d1core = 2152 ctx->d1core =
2152 GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, 2153 GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify,
2153 &connect_notify, NULL, NULL, NULL, GNUNET_NO, 2154 &connect_notify, NULL, NULL, NULL, GNUNET_NO, NULL,
2154 NULL, GNUNET_NO, no_handlers); 2155 GNUNET_NO, no_handlers);
2155 } 2156 }
2157
2158 if (ctx->d1core == NULL)
2159 {
2160 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
2161 return;
2162 }
2156 2163
2157 if (ctx->d1core == NULL) 2164 if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) /* Do not yet have the second peer's hello, set up a task to get it */
2165 {
2166 ctx->d2->th =
2167 GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL,
2168 NULL);
2169 if (ctx->d2->th == NULL)
2158 { 2170 {
2171 GNUNET_CORE_disconnect (ctx->d1core);
2172 ctx->d1core = NULL;
2159 ctx->timeout_task = 2173 ctx->timeout_task =
2160 GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx); 2174 GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
2161 return; 2175 return;
2162 } 2176 }
2177 ctx->d2->ghh =
2178 GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2);
2179 }
2163 2180
2164 if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) /* Do not yet have the second peer's hello, set up a task to get it */ 2181 if (ctx->send_hello == GNUNET_YES)
2165 { 2182 {
2166 ctx->d2->th = 2183 ctx->d1th =
2167 GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, 2184 GNUNET_TRANSPORT_connect (ctx->d1->cfg, &ctx->d1->id, ctx->d1, NULL,
2168 NULL, NULL); 2185 NULL, NULL);
2169 if (ctx->d2->th == NULL) 2186 if (ctx->d1th == NULL)
2170 {
2171 GNUNET_CORE_disconnect (ctx->d1core);
2172 ctx->d1core = NULL;
2173 ctx->timeout_task =
2174 GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
2175 return;
2176 }
2177 ctx->d2->ghh =
2178 GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2);
2179 }
2180
2181 if (ctx->send_hello == GNUNET_YES)
2182 { 2187 {
2183 ctx->d1th = 2188 GNUNET_CORE_disconnect (ctx->d1core);
2184 GNUNET_TRANSPORT_connect (ctx->d1->cfg, &ctx->d1->id, ctx->d1, NULL, 2189 ctx->d1core = NULL;
2185 NULL, NULL); 2190 ctx->timeout_task =
2186 if (ctx->d1th == NULL)
2187 {
2188 GNUNET_CORE_disconnect (ctx->d1core);
2189 ctx->d1core = NULL;
2190 ctx->timeout_task =
2191 GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx); 2191 GNUNET_SCHEDULER_add_now (&notify_connect_result, ctx);
2192 return; 2192 return;
2193 }
2194 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == ctx->hello_send_task);
2195 ctx->hello_send_task = GNUNET_SCHEDULER_add_now (&send_hello, ctx);
2196 } 2193 }
2194 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == ctx->hello_send_task);
2195 ctx->hello_send_task = GNUNET_SCHEDULER_add_now (&send_hello, ctx);
2196 }
2197 2197
2198 ctx->timeout_task = 2198 ctx->timeout_task =
2199 GNUNET_SCHEDULER_add_delayed (ctx->relative_timeout, 2199 GNUNET_SCHEDULER_add_delayed (ctx->relative_timeout,
2200 &notify_connect_result, ctx); 2200 &notify_connect_result, ctx);
2201 2201
2202} 2202}
2203 2203
@@ -2271,29 +2271,28 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
2271 * @param cc connect context 2271 * @param cc connect context
2272 */ 2272 */
2273void 2273void
2274GNUNET_TESTING_daemons_connect_cancel (struct GNUNET_TESTING_ConnectContext 2274GNUNET_TESTING_daemons_connect_cancel (struct GNUNET_TESTING_ConnectContext *cc)
2275 *cc)
2276{ 2275{
2277 if (GNUNET_SCHEDULER_NO_TASK != cc->timeout_task) 2276 if (GNUNET_SCHEDULER_NO_TASK != cc->timeout_task)
2278 { 2277 {
2279 GNUNET_SCHEDULER_cancel (cc->timeout_task); 2278 GNUNET_SCHEDULER_cancel (cc->timeout_task);
2280 cc->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2279 cc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2281 } 2280 }
2282 if (GNUNET_SCHEDULER_NO_TASK != cc->hello_send_task) 2281 if (GNUNET_SCHEDULER_NO_TASK != cc->hello_send_task)
2283 { 2282 {
2284 GNUNET_SCHEDULER_cancel (cc->hello_send_task); 2283 GNUNET_SCHEDULER_cancel (cc->hello_send_task);
2285 cc->hello_send_task = GNUNET_SCHEDULER_NO_TASK; 2284 cc->hello_send_task = GNUNET_SCHEDULER_NO_TASK;
2286 } 2285 }
2287 if (NULL != cc->d1core) 2286 if (NULL != cc->d1core)
2288 { 2287 {
2289 GNUNET_CORE_disconnect (cc->d1core); 2288 GNUNET_CORE_disconnect (cc->d1core);
2290 cc->d1core = NULL; 2289 cc->d1core = NULL;
2291 } 2290 }
2292 if (NULL != cc->d1th) 2291 if (NULL != cc->d1th)
2293 { 2292 {
2294 GNUNET_TRANSPORT_disconnect (cc->d1th); 2293 GNUNET_TRANSPORT_disconnect (cc->d1th);
2295 cc->d1th = NULL; 2294 cc->d1th = NULL;
2296 } 2295 }
2297 GNUNET_free (cc); 2296 GNUNET_free (cc);
2298} 2297}
2299 2298
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index c81373025..4ace9f055 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -893,7 +893,7 @@ struct ConnectContext
893 893
894 /** 894 /**
895 * Context in 'testing.c', to cancel connection attempt. 895 * Context in 'testing.c', to cancel connection attempt.
896 */ 896 */
897 struct GNUNET_TESTING_ConnectContext *cc; 897 struct GNUNET_TESTING_ConnectContext *cc;
898 898
899 /** 899 /**
@@ -3231,10 +3231,9 @@ preschedule_connect (struct GNUNET_TESTING_PeerGroup *pg)
3231 connect_context->first_index = random_peer; 3231 connect_context->first_index = random_peer;
3232 connect_context->second_index = connection_iter->index; 3232 connect_context->second_index = connection_iter->index;
3233 connect_context->ct_ctx = ct_ctx; 3233 connect_context->ct_ctx = ct_ctx;
3234 connect_context->task = GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context); 3234 connect_context->task =
3235 GNUNET_CONTAINER_DLL_insert (pg->cc_head, 3235 GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context);
3236 pg->cc_tail, 3236 GNUNET_CONTAINER_DLL_insert (pg->cc_head, pg->cc_tail, connect_context);
3237 connect_context);
3238 GNUNET_CONTAINER_DLL_remove (pg->peers[random_peer].connect_peers_head, 3237 GNUNET_CONTAINER_DLL_remove (pg->peers[random_peer].connect_peers_head,
3239 pg->peers[random_peer].connect_peers_tail, 3238 pg->peers[random_peer].connect_peers_tail,
3240 connection_iter); 3239 connection_iter);
@@ -3639,9 +3638,7 @@ internal_connect_notify (void *cls, const struct GNUNET_PeerIdentity *first,
3639 connect_ctx->cc = NULL; 3638 connect_ctx->cc = NULL;
3640 GNUNET_assert (0 < pg->outstanding_connects); 3639 GNUNET_assert (0 < pg->outstanding_connects);
3641 pg->outstanding_connects--; 3640 pg->outstanding_connects--;
3642 GNUNET_CONTAINER_DLL_remove (pg->cc_head, 3641 GNUNET_CONTAINER_DLL_remove (pg->cc_head, pg->cc_tail, connect_ctx);
3643 pg->cc_tail,
3644 connect_ctx);
3645 /* 3642 /*
3646 * Check whether the inverse connection has been scheduled yet, 3643 * Check whether the inverse connection has been scheduled yet,
3647 * if not, we can remove it from the other peers list and avoid 3644 * if not, we can remove it from the other peers list and avoid
@@ -3719,33 +3716,36 @@ schedule_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3719 _ 3716 _
3720 ("Delaying connect, we have too many outstanding connections!\n")); 3717 ("Delaying connect, we have too many outstanding connections!\n"));
3721#endif 3718#endif
3722 connect_context->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 3719 connect_context->task =
3723 (GNUNET_TIME_UNIT_MILLISECONDS, 100), 3720 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
3724 &schedule_connect, connect_context); 3721 (GNUNET_TIME_UNIT_MILLISECONDS, 100),
3722 &schedule_connect, connect_context);
3725 return; 3723 return;
3726 } 3724 }
3727#if VERBOSE_TESTING 3725#if VERBOSE_TESTING
3728 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3726 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3729 _ 3727 _
3730 ("Creating connection, outstanding_connections is %d (max %d)\n"), 3728 ("Creating connection, outstanding_connections is %d (max %d)\n"),
3731 pg->outstanding_connects, pg->max_outstanding_connections); 3729 pg->outstanding_connects, pg->max_outstanding_connections);
3732#endif 3730#endif
3733 pg->outstanding_connects++; 3731 pg->outstanding_connects++;
3734 pg->total_connects_scheduled++; 3732 pg->total_connects_scheduled++;
3735 GNUNET_assert (NULL == connect_context->cc); 3733 GNUNET_assert (NULL == connect_context->cc);
3736 connect_context->cc 3734 connect_context->cc =
3737 = GNUNET_TESTING_daemons_connect (pg-> 3735 GNUNET_TESTING_daemons_connect (pg->
3738 peers[connect_context->first_index].daemon, 3736 peers[connect_context->
3739 pg->peers[connect_context-> 3737 first_index].daemon,
3740 second_index].daemon, 3738 pg->peers[connect_context->
3741 connect_context->ct_ctx->connect_timeout, 3739 second_index].daemon,
3742 connect_context->ct_ctx->connect_attempts, 3740 connect_context->ct_ctx->connect_timeout,
3741 connect_context->ct_ctx->connect_attempts,
3743#if USE_SEND_HELLOS 3742#if USE_SEND_HELLOS
3744 GNUNET_NO, 3743 GNUNET_NO,
3745#else 3744#else
3746 GNUNET_YES, 3745 GNUNET_YES,
3747#endif 3746#endif
3748 &internal_connect_notify, connect_context); 3747 &internal_connect_notify,
3748 connect_context);
3749 3749
3750} 3750}
3751 3751
@@ -3772,10 +3772,10 @@ connect_iterator (void *cls, const GNUNET_HashCode * key, void *value)
3772 connect_context->first = first->daemon; 3772 connect_context->first = first->daemon;
3773 connect_context->second = second; 3773 connect_context->second = second;
3774 connect_context->ct_ctx = ct_ctx; 3774 connect_context->ct_ctx = ct_ctx;
3775 connect_context->task = GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context); 3775 connect_context->task =
3776 GNUNET_CONTAINER_DLL_insert (ct_ctx->pg->cc_head, 3776 GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context);
3777 ct_ctx->pg->cc_tail, 3777 GNUNET_CONTAINER_DLL_insert (ct_ctx->pg->cc_head, ct_ctx->pg->cc_tail,
3778 connect_context); 3778 connect_context);
3779 return GNUNET_YES; 3779 return GNUNET_YES;
3780} 3780}
3781#endif 3781#endif
@@ -7103,16 +7103,14 @@ GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg,
7103 7103
7104 GNUNET_assert (pg->total > 0); 7104 GNUNET_assert (pg->total > 0);
7105 while (NULL != (cc = pg->cc_head)) 7105 while (NULL != (cc = pg->cc_head))
7106 { 7106 {
7107 GNUNET_CONTAINER_DLL_remove (pg->cc_head, 7107 GNUNET_CONTAINER_DLL_remove (pg->cc_head, pg->cc_tail, cc);
7108 pg->cc_tail, 7108 if (GNUNET_SCHEDULER_NO_TASK != cc->task)
7109 cc); 7109 GNUNET_SCHEDULER_cancel (cc->task);
7110 if (GNUNET_SCHEDULER_NO_TASK != cc->task) 7110 if (NULL != cc->cc)
7111 GNUNET_SCHEDULER_cancel (cc->task); 7111 GNUNET_TESTING_daemons_connect_cancel (cc->cc);
7112 if (NULL != cc->cc) 7112 GNUNET_free (cc);
7113 GNUNET_TESTING_daemons_connect_cancel (cc->cc); 7113 }
7114 GNUNET_free (cc);
7115 }
7116 7114
7117 shutdown_ctx = GNUNET_malloc (sizeof (struct ShutdownContext)); 7115 shutdown_ctx = GNUNET_malloc (sizeof (struct ShutdownContext));
7118 shutdown_ctx->delete_files = 7116 shutdown_ctx->delete_files =
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c
index 6d3645f01..49990788a 100644
--- a/src/topology/test_gnunet_daemon_topology.c
+++ b/src/topology/test_gnunet_daemon_topology.c
@@ -81,14 +81,14 @@ clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
81{ 81{
82 unsigned int i; 82 unsigned int i;
83 83
84 for (i=0;i<NUM_PEERS;i++) 84 for (i = 0; i < NUM_PEERS; i++)
85 {
86 if (NULL != cc[i])
85 { 87 {
86 if (NULL != cc[i]) 88 GNUNET_TESTING_daemons_connect_cancel (cc[i]);
87 { 89 cc[i] = NULL;
88 GNUNET_TESTING_daemons_connect_cancel (cc[i]);
89 cc[i] = NULL;
90 }
91 } 90 }
91 }
92 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 92 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
93 ok = 0; 93 ok = 0;
94} 94}
@@ -111,12 +111,12 @@ notify_connect_complete (void *cls, const struct GNUNET_PeerIdentity *first,
111 if (NULL != emsg) 111 if (NULL != emsg)
112 { 112 {
113 fprintf (stderr, "Failed to connect two peers: %s\n", emsg); 113 fprintf (stderr, "Failed to connect two peers: %s\n", emsg);
114 for (i=0;i<NUM_PEERS;i++) 114 for (i = 0; i < NUM_PEERS; i++)
115 if (NULL != cc[i]) 115 if (NULL != cc[i])
116 { 116 {
117 GNUNET_TESTING_daemons_connect_cancel (cc[i]); 117 GNUNET_TESTING_daemons_connect_cancel (cc[i]);
118 cc[i] = NULL; 118 cc[i] = NULL;
119 } 119 }
120 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 120 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
121 GNUNET_assert (0); 121 GNUNET_assert (0);
122 return; 122 return;
@@ -145,13 +145,17 @@ my_cb (void *cls, const struct GNUNET_PeerIdentity *id,
145 last = d; 145 last = d;
146 return; 146 return;
147 } 147 }
148 cc[peers_left] = GNUNET_TESTING_daemons_connect (last, d, TIMEOUT, CONNECT_ATTEMPTS, 148 cc[peers_left] =
149 GNUNET_YES, &notify_connect_complete, &cc[peers_left]); 149 GNUNET_TESTING_daemons_connect (last, d, TIMEOUT, CONNECT_ATTEMPTS,
150 GNUNET_YES, &notify_connect_complete,
151 &cc[peers_left]);
150 if (peers_left == 0) 152 if (peers_left == 0)
151 { 153 {
152 /* close circle */ 154 /* close circle */
153 cc[NUM_PEERS-1] = GNUNET_TESTING_daemons_connect (d, first, TIMEOUT, CONNECT_ATTEMPTS, 155 cc[NUM_PEERS - 1] =
154 GNUNET_YES, &notify_connect_complete, &cc[NUM_PEERS-1]); 156 GNUNET_TESTING_daemons_connect (d, first, TIMEOUT, CONNECT_ATTEMPTS,
157 GNUNET_YES, &notify_connect_complete,
158 &cc[NUM_PEERS - 1]);
155 } 159 }
156} 160}
157 161
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 6d44d84c4..9c3a65450 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -582,9 +582,11 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
582 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 582 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
583 &neighbour_timeout_task, n); 583 &neighbour_timeout_task, n);
584 connect_msg.header.size = htons (sizeof (struct SessionConnectMessage)); 584 connect_msg.header.size = htons (sizeof (struct SessionConnectMessage));
585 connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); 585 connect_msg.header.type =
586 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT);
586 connect_msg.reserved = htonl (0); 587 connect_msg.reserved = htonl (0);
587 connect_msg.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 588 connect_msg.timestamp =
589 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
588 GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), 590 GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg),
589 GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); 591 GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL);
590} 592}
diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c
index 74632e617..7df94b68b 100644
--- a/src/transport/gnunet-transport-wlan-helper.c
+++ b/src/transport/gnunet-transport-wlan-helper.c
@@ -1026,4 +1026,3 @@ getChannelFromFrequency (int frequency)
1026 else 1026 else
1027 return -1; 1027 return -1;
1028} 1028}
1029
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index c012e950c..6d06b1af1 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1905,7 +1905,7 @@ wlan_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1905 session, newmsg->message_size); 1905 session, newmsg->message_size);
1906#endif 1906#endif
1907#if DEBUG_wlan_msg_dump 1907#if DEBUG_wlan_msg_dump
1908 hexdump(msgbuf,GNUNET_MIN(msgbuf_size, 256)); 1908 hexdump (msgbuf, GNUNET_MIN (msgbuf_size, 256));
1909#endif 1909#endif
1910 //queue session 1910 //queue session
1911 queue_session (plugin, session); 1911 queue_session (plugin, session);
@@ -2239,7 +2239,8 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr)
2239 else 2239 else
2240 { 2240 {
2241 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME, 2241 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME,
2242 "wlan_data_message_handler got wrong message type: %u\n", ntohs (hdr->size)); 2242 "wlan_data_message_handler got wrong message type: %u\n",
2243 ntohs (hdr->size));
2243 return; 2244 return;
2244 } 2245 }
2245} 2246}
@@ -2665,12 +2666,11 @@ wlan_process_helper (void *cls, void *client,
2665#if DEBUG_wlan 2666#if DEBUG_wlan
2666 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2667 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2667 "Func wlan_process_helper got unknown message with number %u, size %u\n", 2668 "Func wlan_process_helper got unknown message with number %u, size %u\n",
2668 ntohs (hdr->type), 2669 ntohs (hdr->type), ntohs (hdr->size));
2669 ntohs (hdr->size));
2670 2670
2671#endif 2671#endif
2672#if DEBUG_wlan_msg_dump 2672#if DEBUG_wlan_msg_dump
2673 hexdump(hdr,GNUNET_MIN(ntohs (hdr->size), 256)); 2673 hexdump (hdr, GNUNET_MIN (ntohs (hdr->size), 256));
2674#endif 2674#endif
2675 GNUNET_break (0); 2675 GNUNET_break (0);
2676 return; 2676 return;
@@ -2754,25 +2754,25 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin, int testmode)
2754 filenamehw, plugin->interface, testmode); 2754 filenamehw, plugin->interface, testmode);
2755#endif 2755#endif
2756 2756
2757 if (GNUNET_OS_check_helper_binary(filenamehw) == GNUNET_YES) 2757 if (GNUNET_OS_check_helper_binary (filenamehw) == GNUNET_YES)
2758 { 2758 {
2759 plugin->server_proc = 2759 plugin->server_proc =
2760 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, 2760 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout,
2761 filenamehw, filenamehw, plugin->interface, 2761 filenamehw, filenamehw, plugin->interface,
2762 NULL); 2762 NULL);
2763 } 2763 }
2764 else if (GNUNET_OS_check_helper_binary(filenamehw) == GNUNET_NO) 2764 else if (GNUNET_OS_check_helper_binary (filenamehw) == GNUNET_NO)
2765 { 2765 {
2766 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2766 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2767 "gnunet-transport-wlan-helper is not suid, please change it or look at the doku\n"); 2767 "gnunet-transport-wlan-helper is not suid, please change it or look at the doku\n");
2768 GNUNET_break(0); 2768 GNUNET_break (0);
2769 } 2769 }
2770 else 2770 else
2771 { 2771 {
2772 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2772 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2773 "gnunet-transport-wlan-helper not found, please look if it exists and is the $PATH variable!\n"); 2773 "gnunet-transport-wlan-helper not found, please look if it exists and is the $PATH variable!\n");
2774 GNUNET_break(0); 2774 GNUNET_break (0);
2775 } 2775 }
2776 2776
2777 } 2777 }
2778 else if (testmode == 1) 2778 else if (testmode == 1)
@@ -2784,18 +2784,19 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin, int testmode)
2784 filenameloopback, plugin->interface, testmode); 2784 filenameloopback, plugin->interface, testmode);
2785#endif 2785#endif
2786 2786
2787 if (GNUNET_OS_check_helper_binary(filenameloopback) != GNUNET_SYSERR) 2787 if (GNUNET_OS_check_helper_binary (filenameloopback) != GNUNET_SYSERR)
2788 { 2788 {
2789 plugin->server_proc = 2789 plugin->server_proc =
2790 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, 2790 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout,
2791 filenameloopback, filenameloopback, "1", NULL); 2791 filenameloopback, filenameloopback, "1",
2792 } 2792 NULL);
2793 }
2793 else 2794 else
2794 { 2795 {
2795 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2796 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2796 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is the $PATH variable!\n"); 2797 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is the $PATH variable!\n");
2797 GNUNET_break(0); 2798 GNUNET_break (0);
2798 } 2799 }
2799 } 2800 }
2800 else if (testmode == 2) 2801 else if (testmode == 2)
2801 { 2802 {
@@ -2804,18 +2805,19 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin, int testmode)
2804 "Starting gnunet-wlan-helper loopback 2 process cmd: %s %s %i\n", 2805 "Starting gnunet-wlan-helper loopback 2 process cmd: %s %s %i\n",
2805 filenameloopback, plugin->interface, testmode); 2806 filenameloopback, plugin->interface, testmode);
2806#endif 2807#endif
2807 if (GNUNET_OS_check_helper_binary(filenameloopback) != GNUNET_SYSERR) 2808 if (GNUNET_OS_check_helper_binary (filenameloopback) != GNUNET_SYSERR)
2808 { 2809 {
2809 plugin->server_proc = 2810 plugin->server_proc =
2810 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, 2811 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout,
2811 filenameloopback, filenameloopback, "2", NULL); 2812 filenameloopback, filenameloopback, "2",
2812 } 2813 NULL);
2814 }
2813 else 2815 else
2814 { 2816 {
2815 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2817 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2816 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is in the $PATH variable!\n"); 2818 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is in the $PATH variable!\n");
2817 GNUNET_break(0); 2819 GNUNET_break (0);
2818 } 2820 }
2819 } 2821 }
2820 if (plugin->server_proc == NULL) 2822 if (plugin->server_proc == NULL)
2821 { 2823 {
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c
index 077fdac29..c8d9ea21b 100644
--- a/src/transport/test_plugin_transport_wlan_dummy.c
+++ b/src/transport/test_plugin_transport_wlan_dummy.c
@@ -163,13 +163,13 @@ testmode (int argc, char *argv[])
163 erg = mkfifo (FIFO_FILE1, 0666); 163 erg = mkfifo (FIFO_FILE1, 0666);
164 if (0 != erg) 164 if (0 != erg)
165 { 165 {
166 fprintf (stderr, "Error at mkfifo1: %s\n", strerror(errno)); 166 fprintf (stderr, "Error at mkfifo1: %s\n", strerror (errno));
167 //exit(1); 167 //exit(1);
168 } 168 }
169 erg = mkfifo (FIFO_FILE2, 0666); 169 erg = mkfifo (FIFO_FILE2, 0666);
170 if (0 != erg) 170 if (0 != erg)
171 { 171 {
172 fprintf (stderr, "Error at mkfifo2: %s\n", strerror(errno)); 172 fprintf (stderr, "Error at mkfifo2: %s\n", strerror (errno));
173 //exit(1); 173 //exit(1);
174 } 174 }
175 175
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index 0dc6c2a86..9e7bdb9b6 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -284,6 +284,7 @@ main (int argc, char *argv[])
284{ 284{
285 int ret = 0; 285 int ret = 0;
286 int nat_res; 286 int nat_res;
287
287 test_plugin = NULL; 288 test_plugin = NULL;
288 289
289 GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); 290 GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source);
@@ -299,8 +300,9 @@ main (int argc, char *argv[])
299#endif 300#endif
300 NULL); 301 NULL);
301 302
302 if ((test_plugin != NULL) && ((strcmp (test_plugin, "tcp_nat") == 0) || 303 if ((test_plugin != NULL) &&
303 (strcmp (test_plugin, "udp_nat") == 0))) 304 ((strcmp (test_plugin, "tcp_nat") == 0) ||
305 (strcmp (test_plugin, "udp_nat") == 0)))
304 { 306 {
305 nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); 307 nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
306 if (GNUNET_NO == nat_res) 308 if (GNUNET_NO == nat_res)
@@ -329,13 +331,17 @@ main (int argc, char *argv[])
329 struct rlimit r_file_old; 331 struct rlimit r_file_old;
330 struct rlimit r_file_new; 332 struct rlimit r_file_new;
331 int res; 333 int res;
332 res = getrlimit(RLIMIT_NOFILE, &r_file_old);
333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur, r_file_old.rlim_max);
334 334
335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting maximum number of open files to: %u\n", MAX_FILES); 335 res = getrlimit (RLIMIT_NOFILE, &r_file_old);
336 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
337 "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur,
338 r_file_old.rlim_max);
339
340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
341 "Setting maximum number of open files to: %u\n", MAX_FILES);
336 r_file_new.rlim_cur = MAX_FILES; 342 r_file_new.rlim_cur = MAX_FILES;
337 r_file_new.rlim_max = r_file_old.rlim_max; 343 r_file_new.rlim_max = r_file_old.rlim_max;
338 res = setrlimit(RLIMIT_NOFILE, &r_file_new); 344 res = setrlimit (RLIMIT_NOFILE, &r_file_new);
339 345
340 if (res != 0) 346 if (res != 0)
341 { 347 {
@@ -360,8 +366,9 @@ main (int argc, char *argv[])
360 GNUNET_free (test_name); 366 GNUNET_free (test_name);
361 367
362#if HAVE_SETRLIMIT 368#if HAVE_SETRLIMIT
363 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring previous value maximum number of open files\n"); 369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
364 res = setrlimit(RLIMIT_NOFILE, &r_file_old); 370 "Restoring previous value maximum number of open files\n");
371 res = setrlimit (RLIMIT_NOFILE, &r_file_old);
365 if (res != 0) 372 if (res != 0)
366 { 373 {
367 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring limit failed!\n"); 374 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring limit failed!\n");
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c
index a760f4775..968a4324f 100644
--- a/src/transport/transport_api_address_lookup.c
+++ b/src/transport/transport_api_address_lookup.c
@@ -140,8 +140,8 @@ GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
140 return NULL; 140 return NULL;
141 } 141 }
142 client = GNUNET_CLIENT_connect ("transport", cfg); 142 client = GNUNET_CLIENT_connect ("transport", cfg);
143 if (client == NULL) 143 if (client == NULL)
144 return NULL; 144 return NULL;
145 msg = GNUNET_malloc (len); 145 msg = GNUNET_malloc (len);
146 msg->header.size = htons (len); 146 msg->header.size = htons (len);
147 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP); 147 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP);
@@ -172,7 +172,9 @@ GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
172 * @param alc handle for the request to cancel 172 * @param alc handle for the request to cancel
173 */ 173 */
174void 174void
175GNUNET_TRANSPORT_address_lookup_cancel (struct GNUNET_TRANSPORT_AddressLookupContext *alc) 175GNUNET_TRANSPORT_address_lookup_cancel (struct
176 GNUNET_TRANSPORT_AddressLookupContext
177 *alc)
176{ 178{
177 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO); 179 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
178 GNUNET_free (alc); 180 GNUNET_free (alc);
diff --git a/src/transport/transport_api_peer_address_lookup.c b/src/transport/transport_api_peer_address_lookup.c
index 83ed074a3..a564058ce 100644
--- a/src/transport/transport_api_peer_address_lookup.c
+++ b/src/transport/transport_api_peer_address_lookup.c
@@ -141,12 +141,13 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle
141 141
142 client = GNUNET_CLIENT_connect ("transport", cfg); 142 client = GNUNET_CLIENT_connect ("transport", cfg);
143 if (client == NULL) 143 if (client == NULL)
144 return NULL; 144 return NULL;
145 msg.header.size = htons (sizeof (struct PeerAddressLookupMessage)); 145 msg.header.size = htons (sizeof (struct PeerAddressLookupMessage));
146 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP); 146 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP);
147 msg.timeout = GNUNET_TIME_relative_hton (timeout); 147 msg.timeout = GNUNET_TIME_relative_hton (timeout);
148 memcpy (&msg.peer, peer, sizeof (struct GNUNET_PeerIdentity)); 148 memcpy (&msg.peer, peer, sizeof (struct GNUNET_PeerIdentity));
149 alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerAddressLookupContext)); 149 alc =
150 GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerAddressLookupContext));
150 alc->cb = peer_address_callback; 151 alc->cb = peer_address_callback;
151 alc->cb_cls = peer_address_callback_cls; 152 alc->cb_cls = peer_address_callback_cls;
152 alc->timeout = GNUNET_TIME_relative_to_absolute (timeout); 153 alc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
@@ -166,7 +167,9 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle
166 * @param alc handle for the request to cancel 167 * @param alc handle for the request to cancel
167 */ 168 */
168void 169void
169GNUNET_TRANSPORT_peer_address_lookup_cancel (struct GNUNET_TRANSPORT_PeerAddressLookupContext *alc) 170GNUNET_TRANSPORT_peer_address_lookup_cancel (struct
171 GNUNET_TRANSPORT_PeerAddressLookupContext
172 *alc)
170{ 173{
171 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO); 174 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
172 GNUNET_free (alc); 175 GNUNET_free (alc);
diff --git a/src/transport/wlan/helper_common.c b/src/transport/wlan/helper_common.c
index 6a7a5da09..8e1c59421 100644
--- a/src/transport/wlan/helper_common.c
+++ b/src/transport/wlan/helper_common.c
@@ -34,12 +34,12 @@
34 * @return number of bytes written 34 * @return number of bytes written
35 */ 35 */
36int 36int
37send_mac_to_plugin (char *buffer, struct MacAddress * mac) 37send_mac_to_plugin (char *buffer, struct MacAddress *mac)
38{ 38{
39 39
40 struct Wlan_Helper_Control_Message macmsg; 40 struct Wlan_Helper_Control_Message macmsg;
41 41
42 memcpy (&macmsg.mac,(char *) mac, sizeof (struct MacAddress)); 42 memcpy (&macmsg.mac, (char *) mac, sizeof (struct MacAddress));
43 macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message)); 43 macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message));
44 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 44 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
45 45
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c
index a7ab160ea..29850b446 100644
--- a/src/vpn/gnunet-daemon-vpn-helper.c
+++ b/src/vpn/gnunet-daemon-vpn-helper.c
@@ -355,9 +355,10 @@ message_token (void *cls __attribute__ ((unused)), void *client
355 app_type = GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY; 355 app_type = GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY;
356 if (NULL != tcp_tunnel) 356 if (NULL != tcp_tunnel)
357 me->tunnel = tcp_tunnel; 357 me->tunnel = tcp_tunnel;
358 } else 358 }
359 else
359 { 360 {
360 GNUNET_assert (0); 361 GNUNET_assert (0);
361 } 362 }
362 if (me->tunnel == NULL && NULL != cls) 363 if (me->tunnel == NULL && NULL != cls)
363 { 364 {
@@ -489,17 +490,17 @@ message_token (void *cls __attribute__ ((unused)), void *client
489 /* This is a mapping to a gnunet-service */ 490 /* This is a mapping to a gnunet-service */
490 memcpy (hc, &me->desc.service_descriptor, sizeof (GNUNET_HashCode)); 491 memcpy (hc, &me->desc.service_descriptor, sizeof (GNUNET_HashCode));
491 492
492 if ( (IPPROTO_UDP == pkt->ip_hdr.proto) && 493 if ((IPPROTO_UDP == pkt->ip_hdr.proto) &&
493 (me->desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_UDP)) && 494 (me->desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_UDP)) &&
494 (port_in_ports (me->desc.ports, pkt_udp->udp_hdr.dpt) || 495 (port_in_ports (me->desc.ports, pkt_udp->udp_hdr.dpt) ||
495 testBit (me->additional_ports, ntohs (pkt_udp->udp_hdr.dpt))) ) 496 testBit (me->additional_ports, ntohs (pkt_udp->udp_hdr.dpt))))
496 { 497 {
497 hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP); 498 hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP);
498 499
499 memcpy (hc + 1, &pkt_udp->udp_hdr, ntohs (pkt_udp->udp_hdr.len)); 500 memcpy (hc + 1, &pkt_udp->udp_hdr, ntohs (pkt_udp->udp_hdr.len));
500 501
501 } 502 }
502 else if ( (IPPROTO_TCP == pkt->ip_hdr.proto) && 503 else if ((IPPROTO_TCP == pkt->ip_hdr.proto) &&
503 (me-> 504 (me->
504 desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP)) 505 desc.service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP))
505 && (port_in_ports (me->desc.ports, pkt_tcp->tcp_hdr.dpt))) 506 && (port_in_ports (me->desc.ports, pkt_tcp->tcp_hdr.dpt)))
diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c
index bdbf7e001..271c8a772 100644
--- a/src/vpn/gnunet-service-dns.c
+++ b/src/vpn/gnunet-service-dns.c
@@ -1265,16 +1265,14 @@ publish_iterate (void *cls __attribute__ ((unused)), const char *section)
1265 if ((strlen (section) < 8) || 1265 if ((strlen (section) < 8) ||
1266 (0 != strcmp (".gnunet.", section + (strlen (section) - 8)))) 1266 (0 != strcmp (".gnunet.", section + (strlen (section) - 8))))
1267 return; 1267 return;
1268 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1268 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing dns-name %s\n", section);
1269 "Parsing dns-name %s\n",
1270 section);
1271 if (GNUNET_OK != 1269 if (GNUNET_OK !=
1272 GNUNET_CONFIGURATION_get_value_string (cfg, section, "UDP_REDIRECTS", 1270 GNUNET_CONFIGURATION_get_value_string (cfg, section, "UDP_REDIRECTS",
1273 &udp_redirects)) 1271 &udp_redirects))
1274 udp_redirects = NULL; 1272 udp_redirects = NULL;
1275 if (GNUNET_OK != 1273 if (GNUNET_OK !=
1276 GNUNET_CONFIGURATION_get_value_string (cfg, section, "TCP_REDIRECTS", 1274 GNUNET_CONFIGURATION_get_value_string (cfg, section, "TCP_REDIRECTS",
1277 &tcp_redirects)) 1275 &tcp_redirects))
1278 tcp_redirects = NULL; 1276 tcp_redirects = NULL;
1279 1277
1280 if (GNUNET_OK != 1278 if (GNUNET_OK !=
@@ -1307,21 +1305,21 @@ publish_iterate (void *cls __attribute__ ((unused)), const char *section)
1307 publish_name (section, ports, service_type, my_private_key); 1305 publish_name (section, ports, service_type, my_private_key);
1308 if (GNUNET_OK == 1306 if (GNUNET_OK ==
1309 GNUNET_CONFIGURATION_get_value_string (cfg, section, "ALTERNATIVE_NAMES", 1307 GNUNET_CONFIGURATION_get_value_string (cfg, section, "ALTERNATIVE_NAMES",
1310 &alternative_names)) 1308 &alternative_names))
1309 {
1310 for (alternative_name = strtok (alternative_names, " ");
1311 alternative_name != NULL; alternative_name = strtok (NULL, " "))
1311 { 1312 {
1312 for (alternative_name = strtok (alternative_names, " "); 1313 char *altname =
1313 alternative_name != NULL; alternative_name = strtok (NULL, " ")) 1314 alloca (strlen (alternative_name) + strlen (section) + 1 + 1);
1314 { 1315 strcpy (altname, alternative_name);
1315 char *altname = 1316 strcpy (altname + strlen (alternative_name) + 1, section);
1316 alloca (strlen (alternative_name) + strlen (section) + 1 + 1); 1317 altname[strlen (alternative_name)] = '.';
1317 strcpy (altname, alternative_name); 1318
1318 strcpy (altname + strlen (alternative_name) + 1, section); 1319 publish_name (altname, ports, service_type, my_private_key);
1319 altname[strlen (alternative_name)] = '.';
1320
1321 publish_name (altname, ports, service_type, my_private_key);
1322 }
1323 GNUNET_free (alternative_names);
1324 } 1320 }
1321 GNUNET_free (alternative_names);
1322 }
1325 GNUNET_CRYPTO_rsa_key_free (my_private_key); 1323 GNUNET_CRYPTO_rsa_key_free (my_private_key);
1326 GNUNET_free_non_null (udp_redirects); 1324 GNUNET_free_non_null (udp_redirects);
1327 GNUNET_free_non_null (tcp_redirects); 1325 GNUNET_free_non_null (tcp_redirects);