gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10382 - in gnunet/src: fs testing transport util


From: gnunet
Subject: [GNUnet-SVN] r10382 - in gnunet/src: fs testing transport util
Date: Fri, 19 Feb 2010 16:45:16 +0100

Author: grothoff
Date: 2010-02-19 16:45:16 +0100 (Fri, 19 Feb 2010)
New Revision: 10382

Modified:
   gnunet/src/fs/fs_download.c
   gnunet/src/fs/fs_file_information.c
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/gnunet-service-fs.c
   gnunet/src/fs/test_fs_lib_data.conf
   gnunet/src/fs/test_gnunet_service_fs_p2p.c
   gnunet/src/testing/testing.c
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/util/peer.c
Log:
debugging

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/fs/fs_download.c 2010-02-19 15:45:16 UTC (rev 10382)
@@ -36,7 +36,7 @@
 #include "fs.h"
 #include "fs_tree.h"
 
-#define DEBUG_DOWNLOAD GNUNET_NO
+#define DEBUG_DOWNLOAD GNUNET_YES
 
 /**
  * We're storing the IBLOCKS after the
@@ -65,9 +65,9 @@
                     unsigned int treedepth)
 {
   unsigned int i;
-  uint64_t lsize; /* what is the size of all IBlocks for level "i"? */
-  uint64_t loff; /* where do IBlocks for level "i" start? */
-  unsigned int ioff; /* which IBlock corresponds to "off" at level "i"? */
+  uint64_t lsize; /* what is the size of all IBlocks for depth "i"? */
+  uint64_t loff; /* where do IBlocks for depth "i" start? */
+  unsigned int ioff; /* which IBlock corresponds to "off" at depth "i"? */
   
   if (depth == treedepth)
     return off;
@@ -113,7 +113,7 @@
 {
   unsigned int i;
   uint64_t lsize; /* what is the size of the sum of all DBlocks 
-                    that a CHK at level i corresponds to? */
+                    that a CHK at depth i corresponds to? */
 
   if (depth == treedepth)
     return offset;
@@ -504,7 +504,7 @@
     }
 #if DEBUG_DOWNLOAD
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Triggering downloads of children (this block was at level %u and 
offset %llu)\n",
+             "Triggering downloads of children (this block was at depth %u and 
offset %llu)\n",
              sm->depth,
              (unsigned long long) sm->offset);
 #endif
@@ -920,61 +920,4 @@
   GNUNET_free (dc);
 }
 
-
-
-#if 0
-
-
-/**
- * Check if self block is already present on the drive.  If the block
- * is a dblock and present, the ProgressModel is notified. If the
- * block is present and it is an iblock, downloading the children is
- * triggered.
- *
- * Also checks if the block is within the range of blocks
- * that we are supposed to download.  If not, the method
- * returns as if the block is present but does NOT signal
- * progress.
- *
- * @param node that is checked for presence
- * @return GNUNET_YES if present, GNUNET_NO if not.
- */
-static int
-check_node_present (const struct Node *node)
-{
-  int res;
-  int ret;
-  char *data;
-  unsigned int size;
-  GNUNET_HashCode hc;
-
-  size = get_node_size (node);
-  /* first check if node is within range.
-     For now, keeping it simple, we only do
-     this for level-0 nodes */
-  if ((node->level == 0) &&
-      ((node->offset + size < node->ctx->offset) ||
-       (node->offset >= node->ctx->offset + node->ctx->length)))
-    return GNUNET_YES;
-  data = GNUNET_malloc (size);
-  ret = GNUNET_NO;
-  res = read_from_files (node->ctx, node->level, node->offset, data, size);
-  if (res == size)
-    {
-      GNUNET_hash (data, size, &hc);
-      if (0 == memcmp (&hc, &node->chk.key, sizeof (GNUNET_HashCode)))
-        {
-          notify_client_about_progress (node, data, size);
-          if (node->level > 0)
-            iblock_download_children (node, data, size);
-          ret = GNUNET_YES;
-        }
-    }
-  GNUNET_free (data);
-  return ret;
-}
-
-#endif
-
-
 /* end of fs_download.c */

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/fs/fs_file_information.c 2010-02-19 15:45:16 UTC (rev 10382)
@@ -847,7 +847,8 @@
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
                              "unlink",
                              fi->serialization);
-  GNUNET_FS_uri_destroy (fi->keywords);
+  if (NULL != fi->keywords)
+    GNUNET_FS_uri_destroy (fi->keywords);
   GNUNET_CONTAINER_meta_data_destroy (fi->meta);
   GNUNET_free_non_null (fi->serialization);
   if (fi->te != NULL)

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/fs/fs_publish.c  2010-02-19 15:45:16 UTC (rev 10382)
@@ -300,10 +300,8 @@
 
 
 /**
- * We've finished publishing a KBlock
- * as part of a larger upload.  Check
- * the result and continue the larger
- * upload.
+ * We've finished publishing a KBlock as part of a larger upload.
+ * Check the result and continue the larger upload.
  *
  * @param cls the "struct GNUNET_FS_PublishContext*"
  *        of the larger upload
@@ -865,16 +863,25 @@
   if (NULL != p->chk_uri)
     {
       /* upload of "p" complete, publish KBlocks! */
-      GNUNET_FS_publish_ksk (sc->h,
-                            p->keywords,
-                            p->meta,
-                            p->chk_uri,
-                            p->expirationTime,
-                            p->anonymity,
-                            p->priority,
-                            sc->options,
-                            &publish_kblocks_cont,
-                            sc);
+      if (p->keywords != NULL)
+       {
+         GNUNET_FS_publish_ksk (sc->h,
+                                p->keywords,
+                                p->meta,
+                                p->chk_uri,
+                                p->expirationTime,
+                                p->anonymity,
+                                p->priority,
+                                sc->options,
+                                &publish_kblocks_cont,
+                                sc);
+       }
+      else
+       {
+         publish_kblocks_cont (sc,
+                               p->chk_uri,
+                               NULL);
+       }
       return;
     }
   if ( (!p->is_directory) &&

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/fs/gnunet-service-fs.c   2010-02-19 15:45:16 UTC (rev 10382)
@@ -43,7 +43,7 @@
 #include "gnunet-service-fs_indexing.h"
 #include "fs.h"
 
-#define DEBUG_FS GNUNET_NO
+#define DEBUG_FS GNUNET_YES
 
 /**
  * Maximum number of outgoing messages we queue per peer.

Modified: gnunet/src/fs/test_fs_lib_data.conf
===================================================================
--- gnunet/src/fs/test_fs_lib_data.conf 2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/fs/test_fs_lib_data.conf 2010-02-19 15:45:16 UTC (rev 10382)
@@ -12,11 +12,12 @@
 [transport]
 PORT = 43465
 PLUGINS = tcp
+#DEBUG = YES
 
 [arm]
 PORT = 43466
 HOSTNAME = localhost
-DEFAULTSERVICES = resolver datastore transport core fs
+DEFAULTSERVICES = resolver datastore transport core fs peerinfo
 
 [datastore]
 #DEBUG = YES
@@ -28,7 +29,7 @@
 [transport-tcp]
 ALLOW_SHUTDOWN = NO
 TIMEOUT = 300000
-PORT = 43468
+#PORT = 43468
 
 [peerinfo]
 PORT = 43469
@@ -37,12 +38,13 @@
 [core]
 PORT = 43470
 HOSTNAME = localhost
+#DEBUG = YES
 
 [fs]
 PORT = 43471
 HOSTNAME = localhost
-#DEBUG = YES
-#PREFIX = valgrind --tool=memcheck --leak-check=yes
+DEBUG = YES
+PREFIX = valgrind --tool=memcheck --leak-check=yes
 #BINARY = /home/grothoff/bin/gnunet-service-fs
 
 [testing]

Modified: gnunet/src/fs/test_gnunet_service_fs_p2p.c
===================================================================
--- gnunet/src/fs/test_gnunet_service_fs_p2p.c  2010-02-19 13:33:17 UTC (rev 
10381)
+++ gnunet/src/fs/test_gnunet_service_fs_p2p.c  2010-02-19 15:45:16 UTC (rev 
10382)
@@ -26,7 +26,7 @@
 #include "platform.h"
 #include "test_fs_lib.h"
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 /**
  * File-size we use for testing.
@@ -70,7 +70,7 @@
              "Downloading %llu bytes\n",
              (unsigned long long) FILESIZE);
   GNUNET_FS_TEST_download (sched,
-                          daemons[1],
+                          daemons[0],
                           TIMEOUT,
                           1, SEED, uri, 
                           VERBOSE, 
@@ -87,7 +87,7 @@
              "Publishing %llu bytes\n",
              (unsigned long long) FILESIZE);
   GNUNET_FS_TEST_publish (sched,
-                         daemons[1],
+                         daemons[0],
                          TIMEOUT,
                          1, GNUNET_NO, FILESIZE, SEED, 
                          VERBOSE, 
@@ -100,6 +100,8 @@
            const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Daemons started, will now try to connect them\n");
   GNUNET_FS_TEST_daemons_connect (sched,
                                  daemons[0],
                                  daemons[1],
@@ -142,6 +144,7 @@
     GNUNET_GETOPT_OPTION_END
   };
 
+  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
   GNUNET_log_setup ("test_gnunet_service_fs_p2p", 
 #if VERBOSE
                    "DEBUG",
@@ -152,6 +155,7 @@
   GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
                       argvx, "test-gnunet-service-fs-p2p",
                      "nohelp", options, &run, NULL);
+  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
   return 0;
 }
 

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/testing/testing.c        2010-02-19 15:45:16 UTC (rev 10382)
@@ -40,7 +40,7 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_transport_service.h"
 
-#define DEBUG_TESTING GNUNET_YES
+#define DEBUG_TESTING GNUNET_NO
 
 /**
  * How long do we wait after starting gnunet-service-arm
@@ -828,10 +828,13 @@
   if (ctx->hello != NULL)
     {
       GNUNET_TRANSPORT_offer_hello (ctx->d2th, ctx->hello);
-      ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 200));
+      ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello,
+                                                   
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 
+                                                                               
  200));
     }
-
-  ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, 
ctx->timeout_hello, &send_hello, ctx);
+  ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, 
+                                                     ctx->timeout_hello, 
+                                                     &send_hello, ctx);
 }
 
 
@@ -974,7 +977,8 @@
                                                     &notify_connect_result, 
ctx);
 
   GNUNET_TRANSPORT_get_hello (ctx->d1th, &process_hello, ctx);
-  ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, 
ctx->timeout_hello, &send_hello, ctx);
+  ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, 
ctx->timeout_hello,
+                                                     &send_hello, ctx);
 }
 
 

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-02-19 13:33:17 UTC 
(rev 10381)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-02-19 15:45:16 UTC 
(rev 10382)
@@ -2750,10 +2750,6 @@
 {
   int ret;
 
-#if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received `%s' request from client\n", "HELLO");
-#endif
   ret = process_hello (NULL, message);
   GNUNET_SERVER_receive_done (client, ret);
 }

Modified: gnunet/src/util/peer.c
===================================================================
--- gnunet/src/util/peer.c      2010-02-19 13:33:17 UTC (rev 10381)
+++ gnunet/src/util/peer.c      2010-02-19 15:45:16 UTC (rev 10382)
@@ -31,21 +31,18 @@
 struct PeerEntry
 {
   /**
-   * the identifier itself
+   * The identifier itself
    */
   struct GNUNET_PeerIdentity id;
 
   /**
-   * Short version of the identifier;
-   * if the RC==0, then index of next
-   * free slot in table, otherwise 
-   * equal to this slot in the table. 
+   * Short version of the identifier; if the RC==0, then index of next
+   * free slot in table, otherwise equal to this slot in the table.
    */
   GNUNET_PEER_Id pid;
 
   /**
-   * Reference counter, 0 if this slot
-   * is not used.
+   * Reference counter, 0 if this slot is not used.
    */
   unsigned int rc;
 };
@@ -144,6 +141,8 @@
   for (i = count - 1; i >= 0; i--)
     {
       id = ids[i];
+      if (id == 0)
+       continue;
       GNUNET_assert (id < size);
       GNUNET_assert (table[id].rc > 0);
       table[id].rc--;





reply via email to

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