gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9249 - GNUnet/src/applications/fs/ecrs


From: gnunet
Subject: [GNUnet-SVN] r9249 - GNUnet/src/applications/fs/ecrs
Date: Thu, 22 Oct 2009 19:14:13 -0600

Author: nevans
Date: 2009-10-22 19:14:12 -0600 (Thu, 22 Oct 2009)
New Revision: 9249

Modified:
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/ecrs/helper.c
   GNUnet/src/applications/fs/ecrs/search.c
   GNUnet/src/applications/fs/ecrs/upload.c
   GNUnet/src/applications/fs/ecrs/uri.c
Log:
debugging changes, add helper function

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2009-10-23 01:08:17 UTC (rev 
9248)
+++ GNUnet/src/applications/fs/ecrs/download.c  2009-10-23 01:14:12 UTC (rev 
9249)
@@ -303,6 +303,9 @@
   struct GNUNET_ECRS_DownloadContext *rm = node->ctx;
 
   GNUNET_DLL_insert (rm->head, rm->tail, node);
+  GNUNET_GE_LOG (rm->ectx,
+                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+                 "in add_request, rm->have_target is %d\n", rm->have_target);
   GNUNET_FS_start_search (rm->sctx,
                           rm->have_target == GNUNET_NO ? NULL : &rm->target,
                           GNUNET_ECRS_BLOCKTYPE_DATA, 1,
@@ -806,6 +809,9 @@
     rm->handle = -1;
   if (GNUNET_ECRS_uri_test_loc (uri))
     {
+      GNUNET_GE_LOG (rm->ectx,
+                     GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+                     "in GNUNET_ECRS_file_download_partial_start, uri is 
locURI\n");
       GNUNET_hash (&uri->data.loc.peer, sizeof (GNUNET_RSA_PublicKey),
                    &rm->target.hashPubKey);
       rm->have_target = GNUNET_YES;

Modified: GNUnet/src/applications/fs/ecrs/helper.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/helper.c    2009-10-23 01:08:17 UTC (rev 
9248)
+++ GNUnet/src/applications/fs/ecrs/helper.c    2009-10-23 01:14:12 UTC (rev 
9249)
@@ -162,10 +162,12 @@
     return NULL;
   /* allow URI to be given as one and only keyword and
      handle accordingly */
-  if ( (num_keywords == 1) &&
-       (strlen(keywords[0]) > strlen(GNUNET_ECRS_URI_PREFIX)) &&
-       (strncmp(keywords[0], GNUNET_ECRS_URI_PREFIX, 
strlen(GNUNET_ECRS_URI_PREFIX)) == 0) &&
-       (NULL != (uri = GNUNET_ECRS_string_to_uri(ectx, keywords[0])) ) )
+  if ((num_keywords == 1) &&
+      (strlen (keywords[0]) > strlen (GNUNET_ECRS_URI_PREFIX)) &&
+      (strncmp
+       (keywords[0], GNUNET_ECRS_URI_PREFIX,
+        strlen (GNUNET_ECRS_URI_PREFIX)) == 0)
+      && (NULL != (uri = GNUNET_ECRS_string_to_uri (ectx, keywords[0]))))
     return uri;
   uri = GNUNET_malloc (sizeof (URI));
   uri->type = ksk;

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2009-10-23 01:08:17 UTC (rev 
9248)
+++ GNUnet/src/applications/fs/ecrs/search.c    2009-10-23 01:14:12 UTC (rev 
9249)
@@ -314,7 +314,7 @@
   GNUNET_CronTime expiration;
 
   expiration = GNUNET_ntohll (value->expiration_time);
-  if (expiration < GNUNET_get_time ())
+  if ((expiration > 0) && (expiration < GNUNET_get_time ()))
     return GNUNET_OK;           /* expired, ignore! */
   type = ntohl (value->type);
   size = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);

Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c    2009-10-23 01:08:17 UTC (rev 
9248)
+++ GNUnet/src/applications/fs/ecrs/upload.c    2009-10-23 01:14:12 UTC (rev 
9249)
@@ -395,6 +395,8 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
                      "Query for current block at level %u is `%s'.\n", i,
                      &enc);
+      fprintf (stderr, "Query for current block at level %u is `%s'.\n", i,
+               &enc);
 #endif
       if (GNUNET_OK != pushBlock (sock,
                                   &mchk, i + 1, iblocks, priority,
@@ -423,10 +425,9 @@
       iblocks[i] = NULL;
     }
 #if DEBUG_UPLOAD
-  IF_GELOG (ectx,
-            GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-            GNUNET_hash_to_enc (&mchk.query, &enc));
-  GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+  GNUNET_hash_to_enc (&mchk.query, &enc);
+  GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+                 | GNUNET_GE_BULK | GNUNET_GE_DEBUG | GNUNET_GE_REQUEST,
                  "Query for top block is %s\n", &enc);
 #endif
   /* build URI */

Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c       2009-10-23 01:08:17 UTC (rev 
9248)
+++ GNUnet/src/applications/fs/ecrs/uri.c       2009-10-23 01:14:12 UTC (rev 
9249)
@@ -1159,5 +1159,18 @@
   return uri;
 }
 
+int
+GNUNET_ECRS_locURI_extract_peer (const struct GNUNET_ECRS_URI *baseURI,
+                                 GNUNET_EncName ** ret)
+{
+  GNUNET_HashCode hc;
+  if (!GNUNET_ECRS_uri_test_loc (baseURI))
+    return GNUNET_NO;
 
+  GNUNET_hash (&baseURI->data.loc.peer, sizeof (GNUNET_RSA_PublicKey), &hc);
+  GNUNET_hash_to_enc (&hc, *ret);
+
+  return GNUNET_OK;
+}
+
 /* end of uri.c */





reply via email to

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