gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4119 - GNUnet/src/applications/dht/module


From: grothoff
Subject: [GNUnet-SVN] r4119 - GNUnet/src/applications/dht/module
Date: Fri, 29 Dec 2006 21:51:24 -0800 (PST)

Author: grothoff
Date: 2006-12-29 21:51:23 -0800 (Fri, 29 Dec 2006)
New Revision: 4119

Modified:
   GNUnet/src/applications/dht/module/routing.c
Log:
fixing DHT routing

Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c        2006-12-30 05:38:46 UTC 
(rev 4118)
+++ GNUnet/src/applications/dht/module/routing.c        2006-12-30 05:51:23 UTC 
(rev 4119)
@@ -355,7 +355,6 @@
   PeerIdentity next[GET_TRIES];
   const DHT_GET_MESSAGE * get;
   int total;
-  int routed;
   int i;
 #if DEBUG_ROUTING
   EncName enc;
@@ -365,6 +364,7 @@
     GE_BREAK(NULL, 0);
     return SYSERR;
   }
+  get = (const DHT_GET_MESSAGE*) msg;
 #if DEBUG_ROUTING
   hash2enc(&get->key, &enc);
   GE_LOG(coreAPI->ectx,
@@ -374,8 +374,11 @@
 #endif
   if (stats != NULL)
     stats->change(stat_get_requests_received, 1);
-  get = (const DHT_GET_MESSAGE*) msg;
-  
+  if (sender != NULL)
+    addRoute(sender,
+            NULL,
+            NULL,
+            get);  
   total = dht_store_get(&get->key,
                        ntohl(get->type),
                        &routeResult,
@@ -390,7 +393,6 @@
 #endif
     return OK;
   }
-  routed = 0;
   for (i=0;i<GET_TRIES;i++) {
     if (OK != select_dht_peer(&next[i],
                              &get->key,
@@ -400,13 +402,6 @@
     if (-1 == hashCodeCompareDistance(&next[i].hashPubKey,
                                      &coreAPI->myIdentity->hashPubKey,
                                      &get->key)) {
-      if ( (routed == 0) &&
-          (sender != NULL) )
-       addRoute(sender,
-                NULL,
-                NULL,
-                get);
-      routed = 1;
       coreAPI->unicast(&next[i],
                       msg,
                       0, /* FIXME: priority */





reply via email to

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