aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_connectionpool.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-29 21:55:23 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-29 21:55:23 +0000
commit49d8694f79f2c716fd56f803e64e0b9008179970 (patch)
treef62632bf512f270834d60b83cfb5bf6e30e4cf78 /src/testbed/gnunet-service-testbed_connectionpool.c
parentc5bf6746a62e43d0c96fed6bc474f1e42f4c1540 (diff)
downloadgnunet-49d8694f79f2c716fd56f803e64e0b9008179970.tar.gz
gnunet-49d8694f79f2c716fd56f803e64e0b9008179970.zip
-convert to new transport API
Diffstat (limited to 'src/testbed/gnunet-service-testbed_connectionpool.c')
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 020fcb8d7..3115285ea 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -27,6 +27,7 @@
27#include "gnunet-service-testbed.h" 27#include "gnunet-service-testbed.h"
28#include "gnunet-service-testbed_connectionpool.h" 28#include "gnunet-service-testbed_connectionpool.h"
29#include "testbed_api_operations.h" 29#include "testbed_api_operations.h"
30#include "gnunet_transport_core_service.h"
30 31
31/** 32/**
32 * Redefine LOG with a changed log component string 33 * Redefine LOG with a changed log component string
@@ -71,7 +72,7 @@ struct PooledConnection
71 /** 72 /**
72 * The transport handle to the peer corresponding to this entry; can be NULL 73 * The transport handle to the peer corresponding to this entry; can be NULL
73 */ 74 */
74 struct GNUNET_TRANSPORT_Handle *handle_transport; 75 struct GNUNET_TRANSPORT_CoreHandle *handle_transport;
75 76
76 /** 77 /**
77 * The core handle to the peer corresponding to this entry; can be NULL 78 * The core handle to the peer corresponding to this entry; can be NULL
@@ -525,16 +526,20 @@ peer_connect_notify_cb (void *cls,
525 * 526 *
526 * @param cls the #PooledConnection object 527 * @param cls the #PooledConnection object
527 * @param peer the peer that connected 528 * @param peer the peer that connected
529 * @param mq queue for sending data to @a peer
530 * @return NULL
528 */ 531 */
529static void 532static void *
530transport_peer_connect_notify_cb (void *cls, 533transport_peer_connect_notify_cb (void *cls,
531 const struct GNUNET_PeerIdentity *peer) 534 const struct GNUNET_PeerIdentity *peer,
535 struct GNUNET_MQ_Handle *mq)
532{ 536{
533 struct PooledConnection *entry = cls; 537 struct PooledConnection *entry = cls;
534 538
535 peer_connect_notify_cb (entry, 539 peer_connect_notify_cb (entry,
536 peer, 540 peer,
537 GST_CONNECTIONPOOL_SERVICE_TRANSPORT); 541 GST_CONNECTIONPOOL_SERVICE_TRANSPORT);
542 return NULL;
538} 543}
539 544
540 545
@@ -553,12 +558,13 @@ opstart_get_handle_transport (void *cls)
553 LOG_DEBUG ("Opening a transport connection to peer %u\n", 558 LOG_DEBUG ("Opening a transport connection to peer %u\n",
554 entry->index); 559 entry->index);
555 entry->handle_transport = 560 entry->handle_transport =
556 GNUNET_TRANSPORT_connect (entry->cfg, 561 GNUNET_TRANSPORT_core_connect (entry->cfg,
557 NULL, 562 NULL,
558 entry, 563 NULL,
559 NULL, 564 entry,
560 &transport_peer_connect_notify_cb, 565 &transport_peer_connect_notify_cb,
561 NULL); 566 NULL,
567 NULL);
562 if (NULL == entry->handle_transport) 568 if (NULL == entry->handle_transport)
563 { 569 {
564 GNUNET_break (0); 570 GNUNET_break (0);
@@ -589,7 +595,7 @@ oprelease_get_handle_transport (void *cls)
589 595
590 if (NULL == entry->handle_transport) 596 if (NULL == entry->handle_transport)
591 return; 597 return;
592 GNUNET_TRANSPORT_disconnect (entry->handle_transport); 598 GNUNET_TRANSPORT_core_disconnect (entry->handle_transport);
593 entry->handle_transport = NULL; 599 entry->handle_transport = NULL;
594} 600}
595 601
@@ -601,7 +607,8 @@ oprelease_get_handle_transport (void *cls)
601 * @param peer peer identity this notification is about 607 * @param peer peer identity this notification is about
602 */ 608 */
603static void 609static void
604core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) 610core_peer_connect_cb (void *cls,
611 const struct GNUNET_PeerIdentity *peer)
605{ 612{
606 struct PooledConnection *entry = cls; 613 struct PooledConnection *entry = cls;
607 614
@@ -634,9 +641,7 @@ core_startup_cb (void *cls,
634 } 641 }
635 GNUNET_assert (NULL == entry->peer_identity); 642 GNUNET_assert (NULL == entry->peer_identity);
636 entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity); 643 entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
637 GNUNET_memcpy (entry->peer_identity, 644 *entry->peer_identity = *my_identity;
638 my_identity,
639 sizeof (struct GNUNET_PeerIdentity));
640 if (0 == entry->demand) 645 if (0 == entry->demand)
641 return; 646 return;
642 if (NULL != entry->notify_task) 647 if (NULL != entry->notify_task)