gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6888 - in GNUnet/src/applications: dht/module dht/tools ds


From: gnunet
Subject: [GNUnet-SVN] r6888 - in GNUnet/src/applications: dht/module dht/tools dstore_sqlite
Date: Mon, 26 May 2008 07:02:13 -0600 (MDT)

Author: grothoff
Date: 2008-05-26 07:02:12 -0600 (Mon, 26 May 2008)
New Revision: 6888

Modified:
   GNUnet/src/applications/dht/module/cs.c
   GNUnet/src/applications/dht/module/routing.c
   GNUnet/src/applications/dht/tools/dht_api.c
   GNUnet/src/applications/dht/tools/dht_twopeer_test.c
   GNUnet/src/applications/dstore_sqlite/dstore.c
Log:
fx

Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c     2008-05-26 04:08:40 UTC (rev 
6887)
+++ GNUnet/src/applications/dht/module/cs.c     2008-05-26 13:02:12 UTC (rev 
6888)
@@ -139,7 +139,7 @@
 }
 
 /**
- * CS handler for inserting <key,value>-pair into DHT-table.
+ * CS handler for getting key from DHT.
  */
 static int
 csGet (struct GNUNET_ClientHandle *client,

Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c        2008-05-26 04:08:40 UTC 
(rev 6887)
+++ GNUnet/src/applications/dht/module/routing.c        2008-05-26 13:02:12 UTC 
(rev 6888)
@@ -485,13 +485,14 @@
 handleGet (const GNUNET_PeerIdentity * sender,
            const GNUNET_MessageHeader * msg)
 {
-  GNUNET_PeerIdentity next[GET_TRIES];
+  GNUNET_PeerIdentity next[GET_TRIES+1];
   const DHT_MESSAGE *get;
   DHT_MESSAGE aget;
   unsigned int target_value;
   unsigned int hop_count;
   int total;
   int i;
+  int j;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
   GNUNET_EncName henc;
@@ -545,29 +546,33 @@
            GNUNET_DHT_estimate_network_diameter ());
   if (target_value > GET_TRIES)
     target_value = GET_TRIES;
+  j = 0;
+  if (sender != NULL)
+    next[j++] = *sender; /* do not send back to sender! */
   for (i = 0; i < target_value; i++)
     {
       if (GNUNET_OK !=
-          GNUNET_DHT_select_peer (&next[i], &get->key, &next[0], i))
+          GNUNET_DHT_select_peer (&next[j], &get->key, &next[0], j))
         {
 #if DEBUG_ROUTING
           GNUNET_GE_LOG (coreAPI->ectx,
                          GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                          GNUNET_GE_DEVELOPER,
                          "Failed to select peer for fowarding in round 
%d/%d\n",
-                         i, GET_TRIES);
+                         i+1, GET_TRIES);
 #endif
           break;
         }
 #if DEBUG_ROUTING
-      GNUNET_hash_to_enc (&next[i].hashPubKey, &enc);
+      GNUNET_hash_to_enc (&next[j].hashPubKey, &enc);
       GNUNET_GE_LOG (coreAPI->ectx,
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Forwarding DHT GET request to peer `%s'.\n", &enc);
 #endif
-      coreAPI->ciphertext_send (&next[i], &aget.header, DHT_PRIORITY,
+      coreAPI->ciphertext_send (&next[j], &aget.header, DHT_PRIORITY,
                                 DHT_DELAY);
+      j++;
     }
   return GNUNET_OK;
 }
@@ -579,7 +584,7 @@
 handlePut (const GNUNET_PeerIdentity * sender,
            const GNUNET_MessageHeader * msg)
 {
-  GNUNET_PeerIdentity next[PUT_TRIES];
+  GNUNET_PeerIdentity next[PUT_TRIES+1];
   const DHT_MESSAGE *put;
   DHT_MESSAGE *aput;
   GNUNET_CronTime now;
@@ -618,6 +623,8 @@
   if (target_value > PUT_TRIES)
     target_value = PUT_TRIES;
   j = 0;
+  if (sender != NULL)
+    next[j++] = *sender; /* do not send back to sender! */
   for (i = 0; i < target_value; i++)
     {
       if (GNUNET_OK !=
@@ -628,7 +635,7 @@
                          GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                          GNUNET_GE_DEVELOPER,
                          "Failed to select peer for PUT fowarding in round 
%d/%d\n",
-                         i, PUT_TRIES);
+                         i+1, PUT_TRIES);
 #endif
           store = 1;
           continue;

Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2008-05-26 04:08:40 UTC (rev 
6887)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2008-05-26 13:02:12 UTC (rev 
6888)
@@ -186,7 +186,6 @@
   GNUNET_thread_join (thread, &unused);
   GNUNET_thread_release_self (info.parent);
   GNUNET_client_connection_destroy (sock);
-  fprintf (stderr, "returning %d\n", info.total);
   return info.total;
 }
 

Modified: GNUnet/src/applications/dht/tools/dht_twopeer_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-26 
04:08:40 UTC (rev 6887)
+++ GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-26 
13:02:12 UTC (rev 6888)
@@ -96,7 +96,7 @@
 
   /* wait for DHT's to find each other! */
   sock = GNUNET_client_connection_create (NULL, cfg);
-  left = 10;                    /* how many iterations should we wait? */
+  left = 50;                    /* how many iterations should we wait? */
   printf ("Waiting for peers to DHT-connect (1->2)");
   while (GNUNET_OK ==
          GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
@@ -126,7 +126,7 @@
   /* verify that peer2 also sees the other DHT! */
   ok = 0;
   sock = GNUNET_client_connection_create (NULL, cfg);
-  left = 10;                    /* how many iterations should we wait? */
+  left = 50;                    /* how many iterations should we wait? */
   printf ("Waiting for peers to DHT-connect (2->1)");
   while (GNUNET_OK ==
          GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))

Modified: GNUnet/src/applications/dstore_sqlite/dstore.c
===================================================================
--- GNUnet/src/applications/dstore_sqlite/dstore.c      2008-05-26 04:08:40 UTC 
(rev 6887)
+++ GNUnet/src/applications/dstore_sqlite/dstore.c      2008-05-26 13:02:12 UTC 
(rev 6888)
@@ -543,6 +543,11 @@
         }
       dat = sqlite3_column_blob (stmt, 1);
       cnt++;
+#if DEBUG_DSTORE
+      GNUNET_GE_LOG (coreAPI->ectx,
+                    GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
+                    "dstore found result for get: `%.*s\n", size, dat);
+#endif
       if ((handler != NULL) &&
           (GNUNET_OK != handler (key, type, size, dat, closure)))
         {





reply via email to

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