aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-30 20:35:10 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-30 20:35:10 +0000
commita0ba5b741b56036bd35bd9ba88164324b2ff7ada (patch)
tree3fd10a0fc15f9a9e7cf5415b2bec86d97d7fe825 /src/transport/transport_api.c
parent427dd6f998fb1fde515a3b5c800f9f6d308197b2 (diff)
downloadgnunet-a0ba5b741b56036bd35bd9ba88164324b2ff7ada.tar.gz
gnunet-a0ba5b741b56036bd35bd9ba88164324b2ff7ada.zip
-getting ATS and transport to compile again (part of #3047)
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index f83b6c098..cb6cefdb1 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -29,16 +29,11 @@
29 * - test test test 29 * - test test test
30 */ 30 */
31#include "platform.h" 31#include "platform.h"
32#include "gnunet_util_lib.h"
32#include "gnunet_constants.h" 33#include "gnunet_constants.h"
33#include "gnunet_bandwidth_lib.h"
34#include "gnunet_client_lib.h"
35#include "gnunet_constants.h"
36#include "gnunet_container_lib.h"
37#include "gnunet_arm_service.h" 34#include "gnunet_arm_service.h"
38#include "gnunet_hello_lib.h" 35#include "gnunet_hello_lib.h"
39#include "gnunet_protocols.h" 36#include "gnunet_protocols.h"
40#include "gnunet_server_lib.h"
41#include "gnunet_time_lib.h"
42#include "gnunet_transport_service.h" 37#include "gnunet_transport_service.h"
43#include "transport.h" 38#include "transport.h"
44 39
@@ -320,7 +315,7 @@ struct GNUNET_TRANSPORT_Handle
320 * Hash map of the current connected neighbours of this peer. 315 * Hash map of the current connected neighbours of this peer.
321 * Maps peer identities to 'struct Neighbour' entries. 316 * Maps peer identities to 'struct Neighbour' entries.
322 */ 317 */
323 struct GNUNET_CONTAINER_MultiHashMap *neighbours; 318 struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
324 319
325 /** 320 /**
326 * Heap sorting peers with pending messages by the timestamps that 321 * Heap sorting peers with pending messages by the timestamps that
@@ -398,7 +393,7 @@ static struct Neighbour *
398neighbour_find (struct GNUNET_TRANSPORT_Handle *h, 393neighbour_find (struct GNUNET_TRANSPORT_Handle *h,
399 const struct GNUNET_PeerIdentity *peer) 394 const struct GNUNET_PeerIdentity *peer)
400{ 395{
401 return GNUNET_CONTAINER_multihashmap_get (h->neighbours, &peer->hashPubKey); 396 return GNUNET_CONTAINER_multipeermap_get (h->neighbours, peer);
402} 397}
403 398
404 399
@@ -424,8 +419,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
424 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, 419 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
425 MAX_BANDWIDTH_CARRY_S); 420 MAX_BANDWIDTH_CARRY_S);
426 GNUNET_assert (GNUNET_OK == 421 GNUNET_assert (GNUNET_OK ==
427 GNUNET_CONTAINER_multihashmap_put (h->neighbours, 422 GNUNET_CONTAINER_multipeermap_put (h->neighbours,
428 &n->id.hashPubKey, n, 423 &n->id, n,
429 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 424 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
430 return n; 425 return n;
431} 426}
@@ -442,7 +437,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
442 * GNUNET_NO if not. 437 * GNUNET_NO if not.
443 */ 438 */
444static int 439static int
445neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value) 440neighbour_delete (void *cls,
441 const struct GNUNET_PeerIdentity *key, void *value)
446{ 442{
447 struct GNUNET_TRANSPORT_Handle *handle = cls; 443 struct GNUNET_TRANSPORT_Handle *handle = cls;
448 struct Neighbour *n = value; 444 struct Neighbour *n = value;
@@ -452,7 +448,7 @@ neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value)
452 GNUNET_assert (NULL == n->th); 448 GNUNET_assert (NULL == n->th);
453 GNUNET_assert (NULL == n->hn); 449 GNUNET_assert (NULL == n->hn);
454 GNUNET_assert (GNUNET_YES == 450 GNUNET_assert (GNUNET_YES ==
455 GNUNET_CONTAINER_multihashmap_remove (handle->neighbours, key, 451 GNUNET_CONTAINER_multipeermap_remove (handle->neighbours, key,
456 n)); 452 n));
457 GNUNET_free (n); 453 GNUNET_free (n);
458 return GNUNET_YES; 454 return GNUNET_YES;
@@ -568,7 +564,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
568 GNUNET_break (0); 564 GNUNET_break (0);
569 break; 565 break;
570 } 566 }
571 neighbour_delete (h, &dim->peer.hashPubKey, n); 567 neighbour_delete (h, &dim->peer, n);
572 break; 568 break;
573 case GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK: 569 case GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK:
574 if (size != sizeof (struct SendOkMessage)) 570 if (size != sizeof (struct SendOkMessage))
@@ -994,7 +990,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
994 h->client = NULL; 990 h->client = NULL;
995 } 991 }
996 /* Forget about all neighbours that we used to be connected to */ 992 /* Forget about all neighbours that we used to be connected to */
997 GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h); 993 GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, &neighbour_delete, h);
998 if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) 994 if (h->quota_task != GNUNET_SCHEDULER_NO_TASK)
999 { 995 {
1000 GNUNET_SCHEDULER_cancel (h->quota_task); 996 GNUNET_SCHEDULER_cancel (h->quota_task);
@@ -1341,15 +1337,15 @@ GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *o
1341 1337
1342int 1338int
1343GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *handle, 1339GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *handle,
1344 const struct GNUNET_PeerIdentity *peer) 1340 const struct GNUNET_PeerIdentity *peer)
1345{ 1341{
1346 GNUNET_assert (NULL != handle); 1342 GNUNET_assert (NULL != handle);
1347 GNUNET_assert (NULL != peer); 1343 GNUNET_assert (NULL != peer);
1348 1344
1349 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(handle->neighbours, &peer->hashPubKey)) 1345 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (handle->neighbours, peer))
1350 return GNUNET_YES; 1346 return GNUNET_YES;
1351 else 1347 else
1352 return GNUNET_NO; 1348 return GNUNET_NO;
1353} 1349}
1354 1350
1355 1351
@@ -1455,7 +1451,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1455 ret->nd_cb = nd; 1451 ret->nd_cb = nd;
1456 ret->reconnect_delay = GNUNET_TIME_UNIT_ZERO; 1452 ret->reconnect_delay = GNUNET_TIME_UNIT_ZERO;
1457 ret->neighbours = 1453 ret->neighbours =
1458 GNUNET_CONTAINER_multihashmap_create (STARTING_NEIGHBOURS_SIZE, GNUNET_YES); 1454 GNUNET_CONTAINER_multipeermap_create (STARTING_NEIGHBOURS_SIZE, GNUNET_YES);
1459 ret->ready_heap = 1455 ret->ready_heap =
1460 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 1456 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
1461 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n"); 1457 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n");
@@ -1488,7 +1484,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
1488 GNUNET_SCHEDULER_cancel (handle->reconnect_task); 1484 GNUNET_SCHEDULER_cancel (handle->reconnect_task);
1489 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1485 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
1490 } 1486 }
1491 GNUNET_CONTAINER_multihashmap_destroy (handle->neighbours); 1487 GNUNET_CONTAINER_multipeermap_destroy (handle->neighbours);
1492 handle->neighbours = NULL; 1488 handle->neighbours = NULL;
1493 if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK) 1489 if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK)
1494 { 1490 {