gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6861 - in GNUnet/src: applications/dht/tools applications/


From: gnunet
Subject: [GNUnet-SVN] r6861 - in GNUnet/src: applications/dht/tools applications/fs/fsui include
Date: Wed, 21 May 2008 12:37:51 -0600 (MDT)

Author: grothoff
Date: 2008-05-21 12:37:50 -0600 (Wed, 21 May 2008)
New Revision: 6861

Modified:
   GNUnet/src/applications/dht/tools/dht_api.c
   GNUnet/src/applications/dht/tools/dht_loopback_test.c
   GNUnet/src/applications/dht/tools/dht_multipeer_test.c
   GNUnet/src/applications/dht/tools/dht_twopeer_test.c
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/fsui/search.c
   GNUnet/src/include/gnunet_fsui_lib.h
Log:
add search ranking information to resume; also have number of attempts encoded

Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2008-05-21 13:08:42 UTC (rev 
6860)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2008-05-21 18:37:50 UTC (rev 
6861)
@@ -185,6 +185,7 @@
   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_loopback_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_loopback_test.c       2008-05-21 
13:08:42 UTC (rev 6860)
+++ GNUnet/src/applications/dht/tools/dht_loopback_test.c       2008-05-21 
18:37:50 UTC (rev 6861)
@@ -62,7 +62,7 @@
       return -1;
     }
 #if START_PEERS
-  peers = GNUNET_TESTING_start_daemons ("",
+  peers = GNUNET_TESTING_start_daemons ("nat",
                                         "advertising dht stats",
                                         "/tmp/gnunet-dht-loopback-test",
                                         2087, 10000, 1);
@@ -120,7 +120,7 @@
       left--;
     }
   while (left > 0);
-  fprintf (stderr, left > 0 ? "!\n" : "?\n");
+  printf (left > 0 ? "!\n" : "?\n");
   /* end of actual test code */
 
 FAILURE:

Modified: GNUnet/src/applications/dht/tools/dht_multipeer_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_multipeer_test.c      2008-05-21 
13:08:42 UTC (rev 6860)
+++ GNUnet/src/applications/dht/tools/dht_multipeer_test.c      2008-05-21 
18:37:50 UTC (rev 6861)
@@ -160,10 +160,11 @@
         {
           GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + j * 10);
           GNUNET_hash (buf, 4, &key);
-          fprintf (stderr, "Peer %d gets key %d", i, j);
+          printf ("Peer %d gets key %d", i, j);
           for (k = 0; k < NUM_ROUNDS; k++)
             {
-              fprintf (stderr, ".");
+              printf (".");
+             fflush(stdout);
               if (0 < GNUNET_DHT_get (cfg,
                                       ectx,
                                       GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
@@ -173,18 +174,17 @@
             }
           if (k < NUM_ROUNDS)
             {
-              fprintf (stderr, "!\n");
+              printf ("!\n");
               found++;
             }
           else
             {
-              fprintf (stderr, "?\n");
+              printf ("?\n");
             }
         }
     }
   /* end of actual test code */
-  fprintf (stderr,
-           "Found %u out of %u attempts.\n", found, NUM_PEERS * NUM_PEERS);
+  printf ("Found %u out of %u attempts.\n", found, NUM_PEERS * NUM_PEERS);
 FAILURE:
   GNUNET_TESTING_stop_daemons (peers);
   GNUNET_GC_free (cfg);

Modified: GNUnet/src/applications/dht/tools/dht_twopeer_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-21 
13:08:42 UTC (rev 6860)
+++ GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-21 
18:37:50 UTC (rev 6861)
@@ -186,11 +186,12 @@
                               GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
                               &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL));
   GNUNET_hash ("key2", 4, &key);
-  fprintf (stderr, "Peer2 gets key2");
+  printf ("Peer2 gets key2");
   left = 10;
   do
     {
-      fprintf (stderr, ".");
+      printf (".");
+      fflush(stdout);
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
@@ -199,7 +200,7 @@
       left--;
     }
   while (left > 0);
-  fprintf (stderr, left > 0 ? "!\n" : "?\n");
+  printf (left > 0 ? "!\n" : "?\n");
 
   CHECK (left > 0);
   /* switch to peer1 */
@@ -207,11 +208,12 @@
                                             ectx,
                                             "NETWORK", "HOST",
                                             "localhost:2087");
-  fprintf (stderr, "Peer1 gets key");
+  printf ("Peer1 gets key");
   left = 10;
   do
     {
-      fprintf (stderr, ".");
+      printf (".");
+      fflush(stdout);
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
@@ -220,7 +222,7 @@
       left--;
     }
   while (left > 0);
-  fprintf (stderr, left > 0 ? "!\n" : "?\n");
+  printf (left > 0 ? "!\n" : "?\n");
   CHECK (left > 0);
   /* end of actual test code */
 

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2008-05-21 13:08:42 UTC (rev 
6860)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2008-05-21 18:37:50 UTC (rev 
6861)
@@ -336,6 +336,9 @@
   unsigned int valid;
   unsigned int i;
   GNUNET_ECRS_FileInfo *fis;
+  int * av_ranks;
+  unsigned int * av_certs;
+  unsigned int * ap_ranks;
   char *fn;
   char *gh;
   unsigned long long size;
@@ -404,15 +407,27 @@
           pos = pos->next;
         }
       fis = NULL;
+      av_ranks = NULL;
+      av_certs = NULL;
+      ap_ranks = NULL;
       if (valid > 0)
         {
           fis = GNUNET_malloc (sizeof (GNUNET_ECRS_FileInfo) * valid);
+         av_ranks = GNUNET_malloc (sizeof (int) * valid);
+         av_certs = GNUNET_malloc (sizeof (unsigned int) * valid);
+         ap_ranks = GNUNET_malloc (sizeof (unsigned int) * valid);
           pos = list->resultsReceived;
           i = 0;
           while (pos != NULL)
             {
               if (pos->mandatoryMatchesRemaining == 0)
-                fis[i++] = pos->fi;
+               {
+                 fis[i] = pos->fi;
+                 av_ranks[i] = pos->probeSuccess - pos->probeFailure;
+                 av_certs[i] = pos->probeSuccess + pos->probeFailure;
+                 ap_ranks[i] = pos->matchingSearchCount;
+                 i++;
+               }
               pos = pos->next;
             }
         }
@@ -424,8 +439,14 @@
       event.data.SearchResumed.anonymityLevel = list->anonymityLevel;
       event.data.SearchResumed.searchURI = list->uri;
       event.data.SearchResumed.state = list->state;
+      event.data.SearchResumed.availability_rank = av_ranks;
+      event.data.SearchResumed.availability_certainty = av_certs;
+      event.data.SearchResumed.applicability_rank = ap_ranks;
       list->cctx = cb (closure, &event);
       GNUNET_free_non_null (fis);
+      GNUNET_free_non_null (av_ranks);
+      GNUNET_free_non_null (av_certs);
+      GNUNET_free_non_null (ap_ranks);
       list = list->next;
     }
   /* 2b) signal download restarts */

Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c    2008-05-21 13:08:42 UTC (rev 
6860)
+++ GNUnet/src/applications/fs/fsui/search.c    2008-05-21 18:37:50 UTC (rev 
6861)
@@ -57,6 +57,8 @@
       event.data.SearchUpdate.searchURI = ctx->uri;
       event.data.SearchUpdate.availability_rank =
         pos->probeSuccess - pos->probeFailure;
+      event.data.SearchUpdate.availability_certainty =
+        pos->probeSuccess + pos->probeFailure;
       event.data.SearchUpdate.applicability_rank = pos->matchingSearchCount;
     }
   else

Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h        2008-05-21 13:08:42 UTC (rev 
6860)
+++ GNUnet/src/include/gnunet_fsui_lib.h        2008-05-21 18:37:50 UTC (rev 
6861)
@@ -348,14 +348,43 @@
 
       GNUNET_FSUI_SearchContext sc;
 
+      /**
+       * URI used for this search.
+       */
       struct GNUNET_ECRS_URI *searchURI;
 
+      /**
+       * Array of search results.
+       */
       const GNUNET_ECRS_FileInfo *fis;
 
-      unsigned int anonymityLevel;
+      /**
+       * Updated availability rank (negative:
+       * unavailable, positive: available)
+       */
+      int * availability_rank;
 
+      /**
+       * On how many total queries is the given 
+       * availability rank based?
+       */
+      unsigned int * availability_certainty;
+
+      /**
+       * Updated applicability rank (the larger,
+       * the better the result fits the search
+       * criteria).
+       */
+      unsigned int * applicability_rank;
+
+      /**
+       * Size of the fis, availability and
+       * applicability arrays.
+       */
       unsigned int fisSize;
 
+      unsigned int anonymityLevel;
+
       GNUNET_FSUI_State state;
 
     } SearchResumed;
@@ -417,6 +446,12 @@
       int availability_rank;
 
       /**
+       * On how many total queries is the given 
+       * availability rank based?
+       */
+      unsigned int availability_certainty;
+
+      /**
        * Updated applicability rank (the larger,
        * the better the result fits the search
        * criteria).





reply via email to

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