gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6238 - in GNUnet/src/applications/fs: gap lib


From: gnunet
Subject: [GNUnet-SVN] r6238 - in GNUnet/src/applications/fs: gap lib
Date: Sun, 10 Feb 2008 15:37:56 -0700 (MST)

Author: grothoff
Date: 2008-02-10 15:37:54 -0700 (Sun, 10 Feb 2008)
New Revision: 6238

Modified:
   GNUnet/src/applications/fs/gap/fs.c
   GNUnet/src/applications/fs/gap/test_linear_topology.c
   GNUnet/src/applications/fs/lib/check.conf
   GNUnet/src/applications/fs/lib/fslib.c
Log:
fixes

Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-02-10 22:27:32 UTC (rev 6237)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-02-10 22:37:54 UTC (rev 6238)
@@ -139,7 +139,7 @@
             GNUNET_hash_to_enc (&query, &enc));
   GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
                  "FS received REQUEST INSERT (query: `%s', type: %u, priority 
%u)\n",
-                 &enc, type, ntohl (ri->prio));
+                 &enc, ntohl(datum->type), ntohl (ri->prio));
 #endif
   memcpy (&datum[1],
           &ri[1], ntohs (req->size) - sizeof (CS_fs_request_insert_MESSAGE));
@@ -201,6 +201,10 @@
   int ret;
   const CS_fs_request_index_MESSAGE *ri;
   struct GNUNET_GE_Context *cectx;
+#if DEBUG_FS
+  GNUNET_HashCode hc;
+  GNUNET_EncName enc;
+#endif
 
   if (ntohs (req->size) < sizeof (CS_fs_request_index_MESSAGE))
     {
@@ -209,6 +213,18 @@
     }
   cectx = coreAPI->cs_create_client_log_context (sock);
   ri = (const CS_fs_request_index_MESSAGE *) req;
+#if DEBUG_FS
+  GNUNET_EC_file_block_get_query((const DBlock *) &ri[1],
+                                ntohs (ri->header.size) -
+                                sizeof
+                                (CS_fs_request_index_MESSAGE),
+                                &hc);
+  IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+            GNUNET_hash_to_enc (&hc, &enc));
+  GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+                 "FS received REQUEST INDEX (query: `%s', priority %u)\n",
+                 &enc, ntohl (ri->prio));
+#endif
   ret = GNUNET_FS_ONDEMAND_add_indexed_content (cectx,
                                                 datastore,
                                                 ntohl (ri->prio),
@@ -432,6 +448,9 @@
   unsigned int type;
   unsigned int anonymityLevel;
   int have_target;
+#if DEBUG_FS
+  GNUNET_EncName enc;
+#endif
 
   if (ntohs (req->size) < sizeof (CS_fs_request_search_MESSAGE))
     {
@@ -441,6 +460,13 @@
   rs = (const CS_fs_request_search_MESSAGE *) req;
   type = ntohl (rs->type);
   /* try "fast path" avoiding gap/dht if unique reply is locally available */
+#if DEBUG_FS
+  IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+            GNUNET_hash_to_enc (&rs->query[0], &enc));
+  GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+                 "FS received QUERY (query: `%s', type: %u)\n", &enc,
+                 type);
+#endif
   if (type == GNUNET_ECRS_BLOCKTYPE_DATA)
     {
       if ((1 == datastore->get (&rs->query[0],
@@ -452,7 +478,6 @@
     }
   else
     datastore->get (&rs->query[0], type, &fast_path_processor, sock);
-
   anonymityLevel = ntohl (rs->anonymityLevel);
   keyCount =
     1 + (ntohs (req->size) -

Modified: GNUnet/src/applications/fs/gap/test_linear_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_linear_topology.c       2008-02-10 
22:27:32 UTC (rev 6237)
+++ GNUnet/src/applications/fs/gap/test_linear_topology.c       2008-02-10 
22:37:54 UTC (rev 6238)
@@ -172,7 +172,6 @@
                             cfg,
                             *uri,
                             1,
-                            1450 * GNUNET_CRON_SECONDS,
                             &searchCB, &myURI, &testTerminate, NULL);
   GNUNET_ECRS_uri_destroy (*uri);
   *uri = myURI;
@@ -237,7 +236,7 @@
 
   name = makeName (size);
   ret =
-    GNUNET_ECRS_file_uninde (ectx, cfg, name, NULL, NULL, &testTerminate,
+    GNUNET_ECRS_file_unindex (ectx, cfg, name, NULL, NULL, &testTerminate,
                              NULL);
   if (0 != UNLINK (name))
     ret = GNUNET_SYSERR;

Modified: GNUnet/src/applications/fs/lib/check.conf
===================================================================
--- GNUnet/src/applications/fs/lib/check.conf   2008-02-10 22:27:32 UTC (rev 
6237)
+++ GNUnet/src/applications/fs/lib/check.conf   2008-02-10 22:37:54 UTC (rev 
6238)
@@ -16,3 +16,5 @@
 WEAKRANDOM = YES
 
 
+[LOGGING]
+DEVELOPER = YES

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2008-02-10 22:27:32 UTC (rev 
6237)
+++ GNUnet/src/applications/fs/lib/fslib.c      2008-02-10 22:37:54 UTC (rev 
6238)
@@ -102,6 +102,10 @@
    * Flag to signal that we should abort.
    */
   int abort;
+
+  unsigned int total_received;
+
+  unsigned int total_requested;
 };
 
 /**
@@ -156,9 +160,8 @@
       if (GNUNET_OK == GNUNET_client_connection_read (ctx->sock, &hdr))
         {
 #if DEBUG_FSLIB
-          GNUNET_GE_LOG (ctx->ectx,
-                         GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                         "FSLIB: received message from gnunetd\n");
+          fprintf(stderr,
+                 "FSLIB: received message from gnunetd\n");
 #endif
           delay = 100 * GNUNET_CRON_MILLISECONDS;
           /* verify hdr, if reply, process, otherwise
@@ -191,7 +194,7 @@
           value->prio = htonl (0);
           value->anonymityLevel = rep->anonymityLevel;
           value->expirationTime = rep->expirationTime;
-          memcpy (&value[1], &rep[1], size);
+          memcpy (&value[1], &rep[1], size);     
           matched = 0;
           GNUNET_mutex_lock (ctx->lock);
           prev = NULL;
@@ -220,6 +223,12 @@
                       prev = pos;
                       pos = pos->next;
                     }
+#if DEBUG_FSLIB
+                 fprintf(stderr,
+                         "FSLIB passes response %u to client (%d)\n",
+                         ctx->total_received++,
+                         unique);
+#endif
                   if ((spos->callback != NULL) &&
                       (GNUNET_SYSERR == spos->callback (&query,
                                                         value,
@@ -237,10 +246,8 @@
           GNUNET_free (value);
 #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");
+            fprintf(stderr,
+                   "FSLIB: received content but have no pending request\n");
 #endif
           GNUNET_mutex_unlock (ctx->lock);
         }
@@ -272,6 +279,7 @@
 
   GNUNET_GE_ASSERT (ectx, lock != NULL);
   ret = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchContext));
+  memset(ret, 0, sizeof (struct GNUNET_FS_SearchContext));
   ret->ectx = ectx;
   ret->cfg = cfg;
   ret->lock = lock;
@@ -344,9 +352,11 @@
                        (keyCount - 1) * sizeof (GNUNET_HashCode));
   req = (CS_fs_request_search_MESSAGE *) & ret[1];
 #if DEBUG_FSLIB
-  GNUNET_GE_LOG (ctx->ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                 "FSLIB: start search (%p)\n", ret);
+  GNUNET_hash_to_enc (keys, &enc);
+  fprintf(stderr,
+         "FSLIB: start search for `%s' (%p)\n",
+         (char*) &enc,
+         ret);
 #endif
   req->header.size =
     htons (sizeof (CS_fs_request_search_MESSAGE) +
@@ -364,6 +374,12 @@
   GNUNET_mutex_lock (ctx->lock);
   ret->next = ctx->handles;
   ctx->handles = ret;
+#if DEBUG_FSLIB
+  fprintf(stderr,
+         "FSLIB passes request %u to daemon (%d)\n",
+         ctx->total_requested++,
+         type);
+#endif
   GNUNET_client_connection_write (ctx->sock, &req->header);
   GNUNET_mutex_unlock (ctx->lock);
   return GNUNET_OK;
@@ -442,9 +458,8 @@
   memcpy (&ri[1], fn, strlen (fn));
 
 #if DEBUG_FSLIB
-  GNUNET_GE_LOG (ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                 "Sending index initialization request to gnunetd\n");
+  fprintf(stderr,
+         "Sending index initialization request to gnunetd\n");
 #endif
   if (GNUNET_OK != GNUNET_client_connection_write (sock, &ri->header))
     {
@@ -453,9 +468,8 @@
     }
   GNUNET_free (ri);
 #if DEBUG_FSLIB
-  GNUNET_GE_LOG (ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                 "Waiting for confirmation of index initialization request by 
gnunetd\n");
+  fprintf(stderr,
+         "Waiting for confirmation of index initialization request by 
gnunetd\n");
 #endif
   if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
     return GNUNET_SYSERR;
@@ -480,6 +494,10 @@
   CS_fs_request_index_MESSAGE *ri;
   unsigned int size;
   int retry;
+#if DEBUG_FSLIB
+  GNUNET_HashCode hc;
+  GNUNET_EncName enc;
+#endif
 
   size = ntohl (block->size) - sizeof (GNUNET_DatastoreValue);
   ri = GNUNET_malloc (sizeof (CS_fs_request_index_MESSAGE) + size);
@@ -492,9 +510,13 @@
   ri->fileOffset = GNUNET_htonll (offset);
   memcpy (&ri[1], &block[1], size);
 #if DEBUG_FSLIB
-  GNUNET_GE_LOG (ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                 "Sending index request to gnunetd\n");
+  GNUNET_EC_file_block_get_query((const DBlock *) &block[1],
+                                size,
+                                &hc);
+  GNUNET_hash_to_enc (&hc, &enc);
+  fprintf(stderr,
+         "Sending index request for `%s' to gnunetd)\n",
+         (const char*) &enc);
 #endif
   retry = AUTO_RETRY;
   do
@@ -505,9 +527,8 @@
           return GNUNET_SYSERR;
         }
 #if DEBUG_FSLIB
-      GNUNET_GE_LOG (ectx,
-                     GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                     "Waiting for confirmation of index request by gnunetd\n");
+      fprintf(stderr,
+             "Waiting for confirmation of index request by gnunetd\n");
 #endif
       if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
         {





reply via email to

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