gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6198 - in GNUnet/src/applications/fs: collection ecrs gap


From: gnunet
Subject: [GNUnet-SVN] r6198 - in GNUnet/src/applications/fs: collection ecrs gap lib namespace
Date: Thu, 7 Feb 2008 23:50:13 -0700 (MST)

Author: grothoff
Date: 2008-02-07 23:50:12 -0700 (Thu, 07 Feb 2008)
New Revision: 6198

Modified:
   GNUnet/src/applications/fs/collection/collectiontest.c
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/ecrs/downloadtest.c
   GNUnet/src/applications/fs/ecrs/namespacetest.c
   GNUnet/src/applications/fs/ecrs/uritest.c
   GNUnet/src/applications/fs/gap/gap.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/lib/fslibtest.c
   GNUnet/src/applications/fs/namespace/namespace_infotest.c
Log:
fixes

Modified: GNUnet/src/applications/fs/collection/collectiontest.c
===================================================================
--- GNUnet/src/applications/fs/collection/collectiontest.c      2008-02-08 
06:06:01 UTC (rev 6197)
+++ GNUnet/src/applications/fs/collection/collectiontest.c      2008-02-08 
06:50:12 UTC (rev 6198)
@@ -45,6 +45,7 @@
   GNUNET_ECRS_FileInfo fi;
   char *have;
 
+  GNUNET_disable_entropy_gathering();
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
     {

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2008-02-08 06:06:01 UTC (rev 
6197)
+++ GNUnet/src/applications/fs/ecrs/download.c  2008-02-08 06:50:12 UTC (rev 
6198)
@@ -341,7 +341,8 @@
   struct RequestManager *rm = node->ctx;
 
   node->next = rm->head;
-  node->next->prev = node;
+  if (node->next != NULL)
+    node->next->prev = node;
   node->prev = NULL;
   rm->head = node;
   if (rm->tail == NULL)

Modified: GNUnet/src/applications/fs/ecrs/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/downloadtest.c      2008-02-08 06:06:01 UTC 
(rev 6197)
+++ GNUnet/src/applications/fs/ecrs/downloadtest.c      2008-02-08 06:50:12 UTC 
(rev 6198)
@@ -29,6 +29,8 @@
 #include "gnunet_ecrs_lib.h"
 #include "tree.h"
 
+#define START_DAEMONS 0
+
 #define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto 
FAILURE; }
 
 /**
@@ -124,6 +126,7 @@
   ret = GNUNET_SYSERR;
   for (j = SIZE - 16 * 1024; j >= 0; j -= 16 * 1024)
     {
+      fprintf(stderr, ".");
       if (GNUNET_OK == GNUNET_ECRS_file_download_partial (NULL,
                                                           cfg,
                                                           uri,
@@ -180,9 +183,11 @@
 int
 main (int argc, char *argv[])
 {
+#if START_DAEMONS
   pid_t daemon;
+#endif
   int ok;
-  struct GNUNET_ClientServerConnection *sock;
+  struct GNUNET_ClientServerConnection *sock = NULL;
   struct GNUNET_ECRS_URI *uri;
 
   cfg = GNUNET_GC_create ();
@@ -191,31 +196,37 @@
       GNUNET_GC_free (cfg);
       return -1;
     }
+#if START_DAEMONS
   daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
   GNUNET_GE_ASSERT (NULL, daemon > 0);
-  sock = NULL;
   CHECK (GNUNET_OK ==
          GNUNET_wait_for_daemon_running (NULL, cfg,
                                          30 * GNUNET_CRON_SECONDS));
+  GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);        /* give apps time to 
start */
+#endif
   ok = GNUNET_YES;
-  GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);        /* give apps time to 
start */
   sock = GNUNET_client_connection_create (NULL, cfg);
   CHECK (sock != NULL);
 
   /* ACTUAL TEST CODE */
+  fprintf(stderr, "Uploading...\n");
   uri = uploadFile (SIZE);
-  CHECK (NULL != uri);
+  CHECK (NULL != uri)
+  fprintf(stderr, "Downloading...");
   CHECK (GNUNET_OK == downloadFile (SIZE, uri));
   GNUNET_ECRS_uri_destroy (uri);
+  fprintf(stderr, "\nUnindexing...\n");
   CHECK (GNUNET_OK == unindexFile (SIZE));
-  fprintf (stderr, " Ok.\n");
+  fprintf (stderr, "Ok.\n");
 
 
   /* END OF TEST CODE */
 FAILURE:
   if (sock != NULL)
     GNUNET_client_connection_destroy (sock);
+#if START_DAEMONS
   GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+#endif
   GNUNET_GC_free (cfg);
   return (ok == GNUNET_YES) ? 0 : 1;
 }

Modified: GNUnet/src/applications/fs/ecrs/namespacetest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespacetest.c     2008-02-08 06:06:01 UTC 
(rev 6197)
+++ GNUnet/src/applications/fs/ecrs/namespacetest.c     2008-02-08 06:50:12 UTC 
(rev 6198)
@@ -118,6 +118,7 @@
   pid_t daemon;
   int failureCount = 0;
 
+  GNUNET_disable_entropy_gathering();
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
     {

Modified: GNUnet/src/applications/fs/ecrs/uritest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uritest.c   2008-02-08 06:06:01 UTC (rev 
6197)
+++ GNUnet/src/applications/fs/ecrs/uritest.c   2008-02-08 06:50:12 UTC (rev 
6198)
@@ -239,6 +239,7 @@
   int failureCount = 0;
   int i;
 
+  GNUNET_disable_entropy_gathering();
   failureCount += testKeyword ();
   failureCount += testLocation ();
   for (i = 0; i < 255; i++)

Modified: GNUnet/src/applications/fs/gap/gap.c
===================================================================
--- GNUnet/src/applications/fs/gap/gap.c        2008-02-08 06:06:01 UTC (rev 
6197)
+++ GNUnet/src/applications/fs/gap/gap.c        2008-02-08 06:50:12 UTC (rev 
6198)
@@ -190,6 +190,7 @@
   PID_INDEX peer;
   unsigned int index;
   GNUNET_CronTime now;
+  int ret;
 
   GNUNET_GE_ASSERT (NULL, query_count > 0);
   peer = GNUNET_FS_PT_intern (respond_to);
@@ -247,9 +248,18 @@
   table[index] = rl;
 
   /* check local data store */
-  datastore->get (&queries[0], type, datastore_value_processor, rl);
+  ret = datastore->get (&queries[0], type, datastore_value_processor, rl);
+  if ( (type == GNUNET_ECRS_BLOCKTYPE_DATA) &&
+       (ret != 1) )
+    ret = datastore->get (&queries[0],
+                         GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
+                         datastore_value_processor, rl);
+
   /* if not found or not unique, forward */
-  GNUNET_FS_PLAN_request (NULL, peer, rl);
+  if ( (ret != 1) ||
+       (type != GNUNET_ECRS_BLOCKTYPE_DATA) )
+    GNUNET_FS_PLAN_request (NULL, peer, rl);
+  
   GNUNET_mutex_unlock (GNUNET_FS_lock);
 }
 

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2008-02-08 06:06:01 UTC (rev 
6197)
+++ GNUnet/src/applications/fs/lib/fslib.c      2008-02-08 06:50:12 UTC (rev 
6198)
@@ -145,6 +145,7 @@
   const CS_fs_request_search_MESSAGE *req;
   GNUNET_DatastoreValue *value;
   struct GNUNET_FS_SearchHandle *pos;
+  struct GNUNET_FS_SearchHandle *spos;
   struct GNUNET_FS_SearchHandle *prev;
   int unique;
 
@@ -202,24 +203,31 @@
                   memcmp (&query, &req->query[0], sizeof (GNUNET_HashCode)))
                 {
                   matched++;
-                  if ((pos->callback != NULL) &&
-                      (GNUNET_SYSERR == pos->callback (&query,
-                                                       value,
-                                                       pos->closure, 0)))
-                    pos->callback = NULL;
+                 spos = pos;
+                 if (unique)
+                   {
+                     if (prev == NULL)
+                       ctx->handles = pos->next;
+                     else
+                       prev->next = pos->next;
+                     if (prev == NULL)
+                       pos = ctx->handles;
+                     else
+                       pos = prev->next;
+                   }
+                 else
+                   {
+                     prev = pos;
+                     pos = pos->next;
+                   }
+                  if ( (spos->callback != NULL) &&
+                       (GNUNET_SYSERR == spos->callback (&query,
+                                                        value,
+                                                        spos->closure, 0)))
+                    spos->callback = NULL;
+                 if (unique)
+                   GNUNET_free(spos);
                 }
-              if (unique)
-                {
-                  if (prev == NULL)
-                    ctx->handles = pos->next;
-                  else
-                    prev->next = pos->next;
-                  GNUNET_free (pos);
-                  if (prev == NULL)
-                    pos = ctx->handles;
-                  else
-                    pos = prev->next;
-                }
               else
                 {
                   prev = pos;
@@ -227,14 +235,14 @@
                 }
             }
           GNUNET_free (value);
-          GNUNET_mutex_unlock (ctx->lock);
 #if DEBUG_FSLIB
           if (matched == 0)
-            GNUNET_GE_LOG (ctx->ectx,
-                           GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
-                           GNUNET_GE_USER,
-                           "FSLIB: received content but have no pending 
request\n");
+           GNUNET_GE_LOG (ctx->ectx,
+                          GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
+                          GNUNET_GE_USER,
+                          "FSLIB: received content but have no pending 
request\n");        
 #endif
+          GNUNET_mutex_unlock (ctx->lock);
         }
       else
         {

Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c  2008-02-08 06:06:01 UTC (rev 
6197)
+++ GNUnet/src/applications/fs/lib/fslibtest.c  2008-02-08 06:50:12 UTC (rev 
6198)
@@ -203,7 +203,7 @@
   return closure.found;
 }
 
-#define START_DAEMON 0
+#define START_DAEMON 1
 
 int
 main (int argc, char *argv[])

Modified: GNUnet/src/applications/fs/namespace/namespace_infotest.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_infotest.c   2008-02-08 
06:06:01 UTC (rev 6197)
+++ GNUnet/src/applications/fs/namespace/namespace_infotest.c   2008-02-08 
06:50:12 UTC (rev 6198)
@@ -47,6 +47,7 @@
   int newVal;
   struct GNUNET_GC_Configuration *cfg;
 
+  GNUNET_disable_entropy_gathering();
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
     {





reply via email to

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