gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r32240 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r32240 - gnunet/src/mesh
Date: Wed, 5 Feb 2014 20:02:06 +0100

Author: bartpolot
Date: 2014-02-05 20:02:06 +0100 (Wed, 05 Feb 2014)
New Revision: 32240

Modified:
   gnunet/src/mesh/gnunet-service-mesh_dht.c
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_peer.h
Log:
- use HELLOs from DHT to try_connect on TRANSPORT level

Modified: gnunet/src/mesh/gnunet-service-mesh_dht.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_dht.c   2014-02-05 18:16:25 UTC (rev 
32239)
+++ gnunet/src/mesh/gnunet-service-mesh_dht.c   2014-02-05 19:02:06 UTC (rev 
32240)
@@ -222,16 +222,17 @@
   struct GMD_search_handle *h = cls;
   struct GNUNET_HELLO_Message *hello;
   struct MeshPeerPath *p;
+  struct MeshPeer *peer;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Got results!\n");
   p = path_build_from_dht (get_path, get_path_length,
                            put_path, put_path_length);
+  peer = GMP_get_short (p->peers[p->length - 1]);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GMP_2s (peer));
   h->callback (h->cls, p);
   path_destroy (p);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Got type %u!\n", type);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Got size %u!\n", size);
   hello = (struct GNUNET_HELLO_Message *) data;
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "HELLO size %u!\n", GNUNET_HELLO_size (hello));
+  GMP_set_hello (peer, hello);
+  GMP_try_connect (peer);
   return;
 }
 

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2014-02-05 18:16:25 UTC (rev 
32239)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2014-02-05 19:02:06 UTC (rev 
32240)
@@ -1407,21 +1407,13 @@
   struct MeshTunnel3 *t;
   struct MeshPeerPath *p;
   struct MeshConnection *c;
-  struct GNUNET_HELLO_Message *hello;
   int rerun_search;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer));
 
   /* If we have a current hello, try to connect using it. */
-  hello = GMP_get_hello (peer);
-  if (NULL != hello)
-  {
-    struct GNUNET_MessageHeader *mh;
+  GMP_try_connect (peer);
 
-    mh = GNUNET_HELLO_get_header (hello);
-    GNUNET_TRANSPORT_offer_hello (transport_handle, mh, try_connect, peer);
-  }
-
   t = peer->tunnel;
   c = NULL;
   rerun_search = GNUNET_NO;
@@ -1942,6 +1934,26 @@
 
 
 /**
+ * Try to connect to a peer on TRANSPORT level.
+ *
+ * @param peer Peer to whom to connect.
+ */
+void
+GMP_try_connect (struct MeshPeer *peer)
+{
+  struct GNUNET_HELLO_Message *hello;
+  struct GNUNET_MessageHeader *mh;
+
+  hello = GMP_get_hello (peer);
+  if (NULL == hello)
+    return;
+
+  mh = GNUNET_HELLO_get_header (hello);
+  GNUNET_TRANSPORT_offer_hello (transport_handle, mh, try_connect, peer);
+}
+
+
+/**
  * Count the number of known paths toward the peer.
  *
  * @param peer Peer to get path info.

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h  2014-02-05 18:16:25 UTC (rev 
32239)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h  2014-02-05 19:02:06 UTC (rev 
32240)
@@ -337,7 +337,16 @@
 struct GNUNET_HELLO_Message *
 GMP_get_hello (struct MeshPeer *peer);
 
+
 /**
+ * Try to connect to a peer on TRANSPORT level.
+ *
+ * @param peer Peer to whom to connect.
+ */
+void
+GMP_try_connect (struct MeshPeer *peer);
+
+/**
  * Count the number of known paths toward the peer.
  *
  * @param peer Peer to get path info.




reply via email to

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