gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8700 - GNUnet/src/applications/dv_dht/module


From: gnunet
Subject: [GNUnet-SVN] r8700 - GNUnet/src/applications/dv_dht/module
Date: Wed, 15 Jul 2009 16:21:00 -0600

Author: nevans
Date: 2009-07-15 16:21:00 -0600 (Wed, 15 Jul 2009)
New Revision: 8700

Modified:
   GNUnet/src/applications/dv_dht/module/routing.c
Log:
routing now works surprisingly well (at least for small nets)

Modified: GNUnet/src/applications/dv_dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/routing.c     2009-07-15 04:20:49 UTC 
(rev 8699)
+++ GNUnet/src/applications/dv_dht/module/routing.c     2009-07-15 22:21:00 UTC 
(rev 8700)
@@ -347,6 +347,7 @@
   unsigned int routed;
   unsigned int tracked;
   unsigned int i;
+  int match;
   DV_DHT_Source_Route *pos;
   DV_DHT_Source_Route *prev;
 #if DEBUG_ROUTING
@@ -478,6 +479,13 @@
                                         coreAPI->my_identity, key, NULL,
                                         &pos->source);
                 }
+              match = GNUNET_NO;
+              match = GNUNET_bloomfilter_test (bloom, &pos->source.hashPubKey);
+              if (match == GNUNET_YES)
+              {
+                pos = pos->next;
+                continue;
+              }
               dvapi->dv_send (&pos->source,
                               &result->header, DV_DHT_PRIORITY, DV_DHT_DELAY);
 
@@ -1012,9 +1020,11 @@
   struct DV_DHT_Source_Route *pos;
   struct DV_DHT_Source_Route *prev;
   int done;
+  unsigned int records_removed;
 
   done = GNUNET_NO;
   GNUNET_mutex_lock (lock);
+  records_removed = 0;
   for (i = 0; i < rt_size; i++)
     {
       prev = NULL;
@@ -1024,16 +1034,19 @@
           if ((pos->receiver == handler) &&
               (pos->receiver_closure == cls) &&
               (0 == memcmp (key,
-                            &records[i].get.key, sizeof (GNUNET_HashCode))))
-            {
+                            &records[i].get.key, sizeof (GNUNET_HashCode)))
+                            &&
+              (0 == memcmp (&pos->source.hashPubKey,
+                            &coreAPI->my_identity->hashPubKey, sizeof 
(GNUNET_HashCode))))
+          {
               if (prev == NULL)
                 records[i].sources = pos->next;
               else
                 prev->next = pos->next;
               GNUNET_free (pos);
-              done = GNUNET_YES;
+              records_removed++;
               break;
-            }
+          }
           prev = pos;
           pos = prev->next;
         }
@@ -1041,10 +1054,13 @@
         {
           GNUNET_array_grow (records[i].results, records[i].result_count, 0);
         }
-      if (done == GNUNET_YES)
-        break;
     }
   GNUNET_mutex_unlock (lock);
+#if DEBUG_ROUTING
+  GNUNET_GE_LOG (coreAPI->ectx,
+                 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                 GNUNET_GE_BULK, "Removed %u total records\n", 
records_removed);
+#endif
   if (done != GNUNET_YES)
     return GNUNET_SYSERR;
   return GNUNET_OK;





reply via email to

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