gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37619 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r37619 - gnunet/src/testbed
Date: Fri, 29 Jul 2016 23:55:24 +0200

Author: grothoff
Date: 2016-07-29 23:55:23 +0200 (Fri, 29 Jul 2016)
New Revision: 37619

Modified:
   gnunet/src/testbed/gnunet-service-testbed_connectionpool.c
   gnunet/src/testbed/gnunet-service-testbed_connectionpool.h
   gnunet/src/testbed/gnunet-service-testbed_oc.c
Log:
-convert to new transport API

Modified: gnunet/src/testbed/gnunet-service-testbed_connectionpool.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_connectionpool.c  2016-07-29 
21:32:09 UTC (rev 37618)
+++ gnunet/src/testbed/gnunet-service-testbed_connectionpool.c  2016-07-29 
21:55:23 UTC (rev 37619)
@@ -27,6 +27,7 @@
 #include "gnunet-service-testbed.h"
 #include "gnunet-service-testbed_connectionpool.h"
 #include "testbed_api_operations.h"
+#include "gnunet_transport_core_service.h"
 
 /**
  * Redefine LOG with a changed log component string
@@ -71,7 +72,7 @@
   /**
    * The transport handle to the peer corresponding to this entry; can be NULL
    */
-  struct GNUNET_TRANSPORT_Handle *handle_transport;
+  struct GNUNET_TRANSPORT_CoreHandle *handle_transport;
 
   /**
    * The core handle to the peer corresponding to this entry; can be NULL
@@ -525,10 +526,13 @@
  *
  * @param cls the #PooledConnection object
  * @param peer the peer that connected
+ * @param mq queue for sending data to @a peer
+ * @return NULL
  */
-static void
+static void *
 transport_peer_connect_notify_cb (void *cls,
-                                  const struct GNUNET_PeerIdentity *peer)
+                                  const struct GNUNET_PeerIdentity *peer,
+                                 struct GNUNET_MQ_Handle *mq)
 {
   struct PooledConnection *entry = cls;
 
@@ -535,6 +539,7 @@
   peer_connect_notify_cb (entry,
                           peer,
                           GST_CONNECTIONPOOL_SERVICE_TRANSPORT);
+  return NULL;
 }
 
 
@@ -553,12 +558,13 @@
   LOG_DEBUG ("Opening a transport connection to peer %u\n",
              entry->index);
   entry->handle_transport =
-      GNUNET_TRANSPORT_connect (entry->cfg,
-                                NULL,
-                                entry,
-                                NULL,
-                                &transport_peer_connect_notify_cb,
-                                NULL);
+      GNUNET_TRANSPORT_core_connect (entry->cfg,
+                                    NULL,
+                                    NULL,
+                                    entry,
+                                    &transport_peer_connect_notify_cb,
+                                    NULL,
+                                    NULL);
   if (NULL == entry->handle_transport)
   {
     GNUNET_break (0);
@@ -589,7 +595,7 @@
 
   if (NULL == entry->handle_transport)
     return;
-  GNUNET_TRANSPORT_disconnect (entry->handle_transport);
+  GNUNET_TRANSPORT_core_disconnect (entry->handle_transport);
   entry->handle_transport = NULL;
 }
 
@@ -601,7 +607,8 @@
  * @param peer peer identity this notification is about
  */
 static void
-core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
+core_peer_connect_cb (void *cls,
+                     const struct GNUNET_PeerIdentity *peer)
 {
   struct PooledConnection *entry = cls;
 
@@ -634,9 +641,7 @@
   }
   GNUNET_assert (NULL == entry->peer_identity);
   entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
-  GNUNET_memcpy (entry->peer_identity,
-          my_identity,
-          sizeof (struct GNUNET_PeerIdentity));
+  *entry->peer_identity = *my_identity;
   if (0 == entry->demand)
     return;
   if (NULL != entry->notify_task)

Modified: gnunet/src/testbed/gnunet-service-testbed_connectionpool.h
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_connectionpool.h  2016-07-29 
21:32:09 UTC (rev 37618)
+++ gnunet/src/testbed/gnunet-service-testbed_connectionpool.h  2016-07-29 
21:55:23 UTC (rev 37619)
@@ -25,7 +25,7 @@
  */
 #include "gnunet_ats_service.h"
 #include "gnunet_core_service.h"
-#include "gnunet_transport_service.h"
+#include "gnunet_transport_core_service.h"
 
 /**
  * The request handle for obtaining a pooled connection
@@ -90,7 +90,7 @@
 typedef void
 (*GST_connection_pool_connection_ready_cb) (void *cls,
                                             struct GNUNET_CORE_Handle *ch,
-                                            struct GNUNET_TRANSPORT_Handle *th,
+                                            struct GNUNET_TRANSPORT_CoreHandle 
*th,
                                             struct 
GNUNET_ATS_ConnectivityHandle *ac,
                                             const struct GNUNET_PeerIdentity 
*peer_id,
                                             const struct 
GNUNET_CONFIGURATION_Handle *cfg);

Modified: gnunet/src/testbed/gnunet-service-testbed_oc.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_oc.c      2016-07-29 21:32:09 UTC 
(rev 37618)
+++ gnunet/src/testbed/gnunet-service-testbed_oc.c      2016-07-29 21:55:23 UTC 
(rev 37619)
@@ -46,7 +46,7 @@
   /**
    * The transport handle obtained from cache. Do NOT close/disconnect.
    */
-  struct GNUNET_TRANSPORT_Handle *th_;
+  struct GNUNET_TRANSPORT_CoreHandle *th_;
 
   /**
    * Configuration of the peer from cache. Do not free!
@@ -178,7 +178,7 @@
    * Transport handle of the first peer obtained from cache to get its HELLO. 
Do
    * NOT close/disconnect.
    */
-  struct GNUNET_TRANSPORT_Handle *p1th_;
+  struct GNUNET_TRANSPORT_CoreHandle *p1th_;
 
   /**
    * The #GST_ConnectionPool_GetHandle for the peer1's transport handle
@@ -709,7 +709,7 @@
 static void
 occ_cache_get_handle_ats_occ_cb (void *cls,
                                  struct GNUNET_CORE_Handle *ch,
-                                 struct GNUNET_TRANSPORT_Handle *th,
+                                 struct GNUNET_TRANSPORT_CoreHandle *th,
                                  struct GNUNET_ATS_ConnectivityHandle *ac,
                                  const struct GNUNET_PeerIdentity *my_identity,
                                  const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -759,7 +759,7 @@
 static void
 occ_cache_get_handle_ats_rocc_cb (void *cls,
                                   struct GNUNET_CORE_Handle *ch,
-                                  struct GNUNET_TRANSPORT_Handle *th,
+                                  struct GNUNET_TRANSPORT_CoreHandle *th,
                                   struct GNUNET_ATS_ConnectivityHandle *ac,
                                   const struct GNUNET_PeerIdentity 
*my_identity,
                                   const struct GNUNET_CONFIGURATION_Handle 
*cfg)
@@ -921,7 +921,7 @@
 static void
 p2_transport_connect_cache_callback (void *cls,
                                      struct GNUNET_CORE_Handle *ch,
-                                     struct GNUNET_TRANSPORT_Handle *th,
+                                     struct GNUNET_TRANSPORT_CoreHandle *th,
                                      struct GNUNET_ATS_ConnectivityHandle *ac,
                                      const struct GNUNET_PeerIdentity *ignore_,
                                      const struct GNUNET_CONFIGURATION_Handle 
*cfg)
@@ -1063,7 +1063,7 @@
 static void
 p1_transport_connect_cache_callback (void *cls,
                                      struct GNUNET_CORE_Handle *ch,
-                                     struct GNUNET_TRANSPORT_Handle *th,
+                                     struct GNUNET_TRANSPORT_CoreHandle *th,
                                      struct GNUNET_ATS_ConnectivityHandle *ac,
                                      const struct GNUNET_PeerIdentity *ignore_,
                                      const struct GNUNET_CONFIGURATION_Handle 
*cfg)
@@ -1108,7 +1108,7 @@
 static void
 occ_cache_get_handle_core_cb (void *cls,
                               struct GNUNET_CORE_Handle *ch,
-                              struct GNUNET_TRANSPORT_Handle *th,
+                              struct GNUNET_TRANSPORT_CoreHandle *th,
                               struct GNUNET_ATS_ConnectivityHandle *ac,
                               const struct GNUNET_PeerIdentity *my_identity,
                               const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -1759,7 +1759,7 @@
 static void
 rocc_cache_get_handle_transport_cb (void *cls,
                                     struct GNUNET_CORE_Handle *ch,
-                                    struct GNUNET_TRANSPORT_Handle *th,
+                                    struct GNUNET_TRANSPORT_CoreHandle *th,
                                     struct GNUNET_ATS_ConnectivityHandle *ac,
                                     const struct GNUNET_PeerIdentity *ignore_,
                                     const struct GNUNET_CONFIGURATION_Handle 
*cfg)
@@ -1774,9 +1774,9 @@
   }
   rocc->tcc.th_ = th;
   rocc->tcc.cfg = cfg;
-  if (GNUNET_YES ==
-      GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_,
-                                             &rocc->a_id))
+  if (NULL !=
+      GNUNET_TRANSPORT_core_get_mq (rocc->tcc.th_,
+                                   &rocc->a_id))
   {
     LOG_DEBUG ("0x%llx: Target peer %s already connected to local peer: %u\n",
                rocc->op_id,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]