gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11463 - gnunet/src/core
Date: Fri, 21 May 2010 10:11:36 +0200

Author: grothoff
Date: 2010-05-21 10:11:35 +0200 (Fri, 21 May 2010)
New Revision: 11463

Modified:
   gnunet/src/core/gnunet-service-core.c
Log:
do not queue SETKEY messages twice

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-05-21 07:57:48 UTC (rev 
11462)
+++ gnunet/src/core/gnunet-service-core.c       2010-05-21 08:11:35 UTC (rev 
11463)
@@ -381,6 +381,11 @@
    */
   int8_t got_slack;
 
+  /**
+   * Is this a SETKEY message?
+   */
+  int is_setkey;
+
 };
 
 
@@ -2440,6 +2445,7 @@
 static void
 send_key (struct Neighbour *n)
 {
+  struct MessageEntry *pos;
   struct SetKeyMessage *sm;
   struct MessageEntry *me;
   struct PingMessage pp;
@@ -2503,12 +2509,29 @@
                                         &process_hello_retry_send_key, n);
       return;
     }
+  pos = n->encrypted_head;
+  while (pos != NULL)
+    {
+      if (GNUNET_YES == pos->is_setkey)
+       {
+#if DEBUG_CORE
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                     "%s message for `%s' already in the queue, not adding 
another one\n",
+                     "SETKEY",
+                     GNUNET_i2s (&n->peer));
+#endif
+         return;
+       }
+      pos = pos->next;
+    }
+
   /* first, set key message */
   me = GNUNET_malloc (sizeof (struct MessageEntry) +
                       sizeof (struct SetKeyMessage));
   me->deadline = GNUNET_TIME_relative_to_absolute (MAX_SET_KEY_DELAY);
   me->priority = SET_KEY_PRIORITY;
   me->size = sizeof (struct SetKeyMessage);
+  me->is_setkey = GNUNET_YES;
   GNUNET_CONTAINER_DLL_insert_after (n->encrypted_head,
                                     n->encrypted_tail,
                                     n->encrypted_tail,
@@ -2535,7 +2558,7 @@
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CRYPTO_rsa_sign (my_private_key, &sm->purpose,
                                          &sm->signature));
-
+  
   /* second, encrypted PING message */
   me = GNUNET_malloc (sizeof (struct MessageEntry) +
                       sizeof (struct PingMessage));




reply via email to

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