gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10202 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r10202 - gnunet/src/core
Date: Wed, 3 Feb 2010 20:34:30 +0100

Author: nevans
Date: 2010-02-03 20:34:30 +0100 (Wed, 03 Feb 2010)
New Revision: 10202

Modified:
   gnunet/src/core/gnunet-service-core.c
Log:
some minor changes that made things not work, but other things still are 
keeping things from working now

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-02-03 16:29:30 UTC (rev 
10201)
+++ gnunet/src/core/gnunet-service-core.c       2010-02-03 19:34:30 UTC (rev 
10202)
@@ -1744,7 +1744,7 @@
     {
 #if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Core received `%s' request for `%4s', will try to establish 
connection within %llu ms\n",
+                  "\n\n\nCore received `%s' request for `%4s', will try to 
establish connection within %llu ms\n\n\n",
                  "SEND",
                   GNUNET_i2s (&sm->peer),
                  GNUNET_TIME_absolute_get_remaining
@@ -1917,6 +1917,22 @@
 
 
 /**
+ * Task that will retry "send_key" if our previous attempt failed
+ * to yield a PONG.
+ */
+static void
+set_key_retry_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  struct Neighbour *n = cls;
+
+  n->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK;
+  n->set_key_retry_frequency =
+    GNUNET_TIME_relative_multiply (n->set_key_retry_frequency, 2);
+  send_key (n);
+}
+
+
+/**
  * PEERINFO is giving us a HELLO for a peer.  Add the public key to
  * the neighbour's struct and retry send_key.  Or, if we did not get a
  * HELLO, just do nothing.
@@ -1936,12 +1952,37 @@
 
   if (peer == NULL)
     {
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Entered process_hello_retry_send_key Peer is null!\n");
+#endif
       n->pitr = NULL;
+      if (n->public_key != NULL)
+        send_key (n);
+      else
+        n->retry_set_key_task
+                = GNUNET_SCHEDULER_add_delayed (sched,
+                                                n->set_key_retry_frequency,
+                                                &set_key_retry_task, n);
       return;
     }
+
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "process_hello_retry_send_key for peer %s\n",
+              GNUNET_i2s (peer));
+#endif
   if (n->public_key != NULL)
-    return;
+    {
 #if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "already have public key for peer %s!! (so why are we here?)\n",
+              GNUNET_i2s (peer));
+#endif
+      return;
+    }
+
+#if DEBUG_CORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received new `%s' message for `%4s', initiating key 
exchange.\n",
              "HELLO",
@@ -1953,29 +1994,16 @@
     {
       GNUNET_free (n->public_key);
       n->public_key = NULL;
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "GNUNET_HELLO_get_key returned awfully\n");
+#endif
       return;
     }
-  send_key (n);
 }
 
 
 /**
- * Task that will retry "send_key" if our previous attempt failed
- * to yield a PONG.
- */
-static void
-set_key_retry_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct Neighbour *n = cls;
-
-  n->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK;
-  n->set_key_retry_frequency =
-    GNUNET_TIME_relative_multiply (n->set_key_retry_frequency, 2);
-  send_key (n);
-}
-
-
-/**
  * Send our key (and encrypted PING) to the other peer.
  *
  * @param n the other peer
@@ -1990,8 +2018,16 @@
 
   if ( (n->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK) ||
        (n->pitr != NULL) )
-    return; /* already in progress */
+    {
 #if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Key exchange in progress with `%4s'.\n",
+                  GNUNET_i2s (&n->peer));
+#endif
+      return; /* already in progress */
+    }
+
+#if DEBUG_CORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Asked to perform key exchange with `%4s'.\n",
               GNUNET_i2s (&n->peer));
@@ -2001,15 +2037,16 @@
       /* lookup n's public key, then try again */
 #if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Lacking public key for `%4s', trying to obtain one.\n",
+                  "Lacking public key for `%4s', trying to obtain one 
(send_key).\n",
                   GNUNET_i2s (&n->peer));
 #endif
       GNUNET_assert (n->pitr == NULL);
+      //sleep(10);
       n->pitr = GNUNET_PEERINFO_iterate (cfg,
                                         sched,
                                         &n->peer,
                                         0,
-                                        GNUNET_TIME_UNIT_MINUTES,
+                                        
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20),
                                         &process_hello_retry_send_key, n);
       return;
     }
@@ -2266,7 +2303,7 @@
     {
 #if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Lacking public key for peer, trying to obtain one.\n");
+                  "Lacking public key for peer, trying to obtain one 
(handle_set_key).\n");
 #endif
       m_cpy = GNUNET_malloc (sizeof (struct SetKeyMessage));
       memcpy (m_cpy, m, sizeof (struct SetKeyMessage));
@@ -2428,10 +2465,10 @@
       /* PONG malformed */
 #if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Received malfromed `%s' wanted sender `%4s' with challenge 
%u\n",
+                  "Received malformed `%s' wanted sender `%4s' with challenge 
%u\n",
                   "PONG", GNUNET_i2s (&n->peer), n->ping_challenge);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Received malfromed `%s' received from `%4s' with challenge 
%u\n",
+                  "Received malformed `%s' received from `%4s' with challenge 
%u\n",
                   "PONG", GNUNET_i2s (&t.target), ntohl (t.challenge));
 #endif
       GNUNET_break_op (0);
@@ -2447,6 +2484,11 @@
       return;
     case PEER_STATE_KEY_RECEIVED:
       n->status = PEER_STATE_KEY_CONFIRMED;
+#if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Confirmed key via %s for peer %s\n",
+                  "PONG", GNUNET_i2s (&n->peer));
+#endif
       if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK)
         {
           GNUNET_SCHEDULER_cancel (sched, n->retry_set_key_task);





reply via email to

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