gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36532 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r36532 - gnunet/src/cadet
Date: Sun, 18 Oct 2015 15:53:16 +0200

Author: grothoff
Date: 2015-10-18 15:53:16 +0200 (Sun, 18 Oct 2015)
New Revision: 36532

Modified:
   gnunet/src/cadet/gnunet-service-cadet_dht.c
   gnunet/src/cadet/gnunet-service-cadet_peer.c
Log:
-track hello offer handle while it is active

Modified: gnunet/src/cadet/gnunet-service-cadet_dht.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_dht.c 2015-10-18 13:45:28 UTC (rev 
36531)
+++ gnunet/src/cadet/gnunet-service-cadet_dht.c 2015-10-18 13:53:16 UTC (rev 
36532)
@@ -154,9 +154,9 @@
  * @param exp when will this value expire
  * @param key key of the result
  * @param get_path path of the get request
- * @param get_path_length lenght of get_path
+ * @param get_path_length lenght of @a get_path
  * @param put_path path of the put request
- * @param put_path_length length of the put_path
+ * @param put_path_length length of the @a put_path
  * @param type type of the result
  * @param size number of bytes in data
  * @param data pointer to the result data
@@ -185,11 +185,15 @@
   }
 
   s = path_2s (p);
-  LOG (GNUNET_ERROR_TYPE_INFO, "Got path from DHT: %s\n", s);
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "Got path from DHT: %s\n",
+       s);
   GNUNET_free_non_null (s);
 
   peer = GCP_get_short (p->peers[p->length - 1], GNUNET_YES);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GCP_2s (peer));
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Got HELLO for %s\n",
+       GCP_2s (peer));
   h->callback (h->cls, p);
   path_destroy (p);
   hello = (struct GNUNET_HELLO_Message *) data;

Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c        2015-10-18 13:45:28 UTC 
(rev 36531)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c        2015-10-18 13:53:16 UTC 
(rev 36532)
@@ -189,6 +189,11 @@
    * Hello message.
    */
   struct GNUNET_HELLO_Message* hello;
+
+  /**
+   * Handle to us offering the HELLO to the transport.
+   */
+  struct GNUNET_TRANSPORT_OfferHelloHandle *hello_offer;
 };
 
 
@@ -742,7 +747,9 @@
   while (NULL != p)
   {
     nextp = p->next;
-    GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, p);
+    GNUNET_CONTAINER_DLL_remove (peer->path_head,
+                                 peer->path_tail,
+                                 p);
     path_destroy (p);
     p = nextp;
   }
@@ -755,6 +762,11 @@
   }
   if (NULL != peer->core_transmit)
     GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit);
+  if (NULL != peer->hello_offer)
+  {
+    GNUNET_TRANSPORT_offer_hello_cancel (peer->hello_offer);
+    peer->hello_offer = NULL;
+  }
   GNUNET_free_non_null (peer->hello);
   GNUNET_free (peer);
   return GNUNET_OK;
@@ -1906,10 +1918,12 @@
  * @param tc TaskContext.
  */
 static void
-try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+try_connect (void *cls,
+             const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct CadetPeer *peer = cls;
 
+  peer->hello_offer = NULL;
   if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
     return;
 
@@ -1934,8 +1948,9 @@
   int rerun_search;
 
   GCC_check_connections ();
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GCP_2s (peer));
-
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "peer_connect towards %s\n",
+       GCP_2s (peer));
   /* If we have a current hello, try to connect using it. */
   GCP_try_connect (peer);
 
@@ -2539,10 +2554,10 @@
     return;
 
   mh = GNUNET_HELLO_get_header (hello);
-  GNUNET_TRANSPORT_offer_hello (transport_handle,
-                                mh,
-                                &try_connect,
-                                peer);
+  peer->hello_offer = GNUNET_TRANSPORT_offer_hello (transport_handle,
+                                                    mh,
+                                                    &try_connect,
+                                                    peer);
   GCC_check_connections ();
 }
 




reply via email to

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