gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22219 - in gnunet/src: fs include


From: gnunet
Subject: [GNUnet-SVN] r22219 - in gnunet/src: fs include
Date: Sat, 23 Jun 2012 10:35:49 +0200

Author: grothoff
Date: 2012-06-23 10:35:49 +0200 (Sat, 23 Jun 2012)
New Revision: 22219

Modified:
   gnunet/src/fs/fs.h
   gnunet/src/fs/fs_download.c
   gnunet/src/fs/fs_search.c
   gnunet/src/fs/gnunet-service-fs_lc.c
   gnunet/src/fs/gnunet-service-fs_pr.c
   gnunet/src/fs/gnunet-service-fs_pr.h
   gnunet/src/include/gnunet_fs_service.h
Log:
-passing total trust offered along (fixing #1369)

Modified: gnunet/src/fs/fs.h
===================================================================
--- gnunet/src/fs/fs.h  2012-06-23 08:19:19 UTC (rev 22218)
+++ gnunet/src/fs/fs.h  2012-06-23 08:35:49 UTC (rev 22219)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and 
other contributing authors)
+     (C) 2003--2012 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -321,6 +321,18 @@
    */
   struct GNUNET_TIME_AbsoluteNBO last_transmission;
 
+  /**
+   * How often did we transmit this query before getting an
+   * answer (estimate).
+   */
+  uint32_t num_transmissions;
+
+  /**
+   * How much respect did we offer (in total) before getting an
+   * answer (estimate).
+   */
+  uint32_t respect_offered;
+
   /* this is followed by the actual encrypted content */
 
 };

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2012-06-23 08:19:19 UTC (rev 22218)
+++ gnunet/src/fs/fs_download.c 2012-06-23 08:35:49 UTC (rev 22219)
@@ -166,6 +166,11 @@
   struct GNUNET_FS_DownloadContext *dc;
 
   /**
+   * When did we last transmit the request?
+   */
+  struct GNUNET_TIME_Absolute last_transmission;
+
+  /**
    * Number of bytes in data.
    */
   size_t size;
@@ -181,10 +186,15 @@
   int do_store;
 
   /**
-   * When did we last transmit the request?
+   * how much respect did we offer to get this reply?
    */
-  struct GNUNET_TIME_Absolute last_transmission;
+  uint32_t respect_offered;
 
+  /**
+   * how often did we transmit the query?
+   */
+  uint32_t num_transmissions;
+
 };
 
 
@@ -1069,7 +1079,8 @@
   pi.value.download.specifics.progress.offset = dr->offset;
   pi.value.download.specifics.progress.data_len = prc->size;
   pi.value.download.specifics.progress.depth = dr->depth;
-  pi.value.download.specifics.progress.respect_offered = 0;
+  pi.value.download.specifics.progress.respect_offered = prc->respect_offered;
+  pi.value.download.specifics.progress.num_transmissions = 
prc->num_transmissions;
   if (prc->last_transmission.abs_value != 
GNUNET_TIME_UNIT_FOREVER_ABS.abs_value)
     pi.value.download.specifics.progress.block_download_duration 
       = GNUNET_TIME_absolute_get_duration (prc->last_transmission);
@@ -1195,6 +1206,8 @@
  *
  * @param dc our download context
  * @param type type of the result
+ * @param respect_offered how much respect did we offer to get this reply?
+ * @param num_transmissions how often did we transmit the query?
  * @param last_transmission when was this block requested the last time? 
(FOREVER if unknown/not applicable)
  * @param data the (encrypted) response
  * @param size size of data
@@ -1202,6 +1215,8 @@
 static void
 process_result (struct GNUNET_FS_DownloadContext *dc,
                 enum GNUNET_BLOCK_Type type,
+               uint32_t respect_offered,
+               uint32_t num_transmissions,
                 struct GNUNET_TIME_Absolute last_transmission,
                 const void *data, size_t size)
 {
@@ -1209,10 +1224,12 @@
 
   prc.dc = dc;
   prc.data = data;
+  prc.last_transmission = last_transmission;
   prc.size = size;
   prc.type = type;
   prc.do_store = GNUNET_YES;
-  prc.last_transmission = last_transmission;
+  prc.respect_offered = respect_offered;
+  prc.num_transmissions = num_transmissions;
   GNUNET_CRYPTO_hash (data, size, &prc.query);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received result for query `%s' from `%s'-service\n",
@@ -1247,6 +1264,8 @@
   msize = ntohs (msg->size);
   cm = (const struct ClientPutMessage *) msg;
   process_result (dc, ntohl (cm->type),
+                 ntohl (cm->respect_offered),
+                 ntohl (cm->num_transmissions),
                   GNUNET_TIME_absolute_ntoh (cm->last_transmission), &cm[1],
                   msize - sizeof (struct ClientPutMessage));
   if (NULL == dc->client)

Modified: gnunet/src/fs/fs_search.c
===================================================================
--- gnunet/src/fs/fs_search.c   2012-06-23 08:19:19 UTC (rev 22218)
+++ gnunet/src/fs/fs_search.c   2012-06-23 08:35:49 UTC (rev 22219)
@@ -762,7 +762,8 @@
  */
 static void
 process_result (struct GNUNET_FS_SearchContext *sc, enum GNUNET_BLOCK_Type 
type,
-                struct GNUNET_TIME_Absolute expiration, const void *data,
+                struct GNUNET_TIME_Absolute expiration, 
+               const void *data,
                 size_t size)
 {
   if (GNUNET_TIME_absolute_get_duration (expiration).rel_value > 0)

Modified: gnunet/src/fs/gnunet-service-fs_lc.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_lc.c        2012-06-23 08:19:19 UTC (rev 
22218)
+++ gnunet/src/fs/gnunet-service-fs_lc.c        2012-06-23 08:35:49 UTC (rev 
22219)
@@ -267,6 +267,8 @@
     pm->type = htonl (type);
     pm->expiration = GNUNET_TIME_absolute_hton (expiration);
     pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
+    pm->num_transmissions = htonl (prd->num_transmissions);
+    pm->respect_offered = htonl (prd->respect_offered);
     memcpy (&pm[1], data, data_len);
     GSF_local_client_transmit_ (lc, &pm->header);
   }

Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c        2012-06-23 08:19:19 UTC (rev 
22218)
+++ gnunet/src/fs/gnunet-service-fs_pr.c        2012-06-23 08:35:49 UTC (rev 
22219)
@@ -530,6 +530,8 @@
   else
     prio = 0;
   pr->public_data.priority -= prio;
+  pr->public_data.num_transmissions++;
+  pr->public_data.respect_offered += prio;
   gm->priority = htonl (prio);
   now = GNUNET_TIME_absolute_get ();
   ttl = (int64_t) (pr->public_data.ttl.abs_value - now.abs_value);

Modified: gnunet/src/fs/gnunet-service-fs_pr.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.h        2012-06-23 08:19:19 UTC (rev 
22218)
+++ gnunet/src/fs/gnunet-service-fs_pr.h        2012-06-23 08:35:49 UTC (rev 
22219)
@@ -133,6 +133,22 @@
   uint32_t original_priority;
 
   /**
+   * Counter for how often this request has been transmitted (estimate,
+   * because we might have the same request pending for multiple clients,
+   * and of course because a transmission may have failed at a lower
+   * layer).
+   */
+  uint32_t num_transmissions;
+
+  /**
+   * How much respect did we (in total) offer for this request so far 
(estimate,
+   * because we might have the same request pending for multiple clients,
+   * and of course because a transmission may have failed at a lower
+   * layer).
+   */
+  uint32_t respect_offered;
+
+  /**
    * Options for the request.
    */
   enum GSF_PendingRequestOptions options;

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2012-06-23 08:19:19 UTC (rev 
22218)
+++ gnunet/src/include/gnunet_fs_service.h      2012-06-23 08:35:49 UTC (rev 
22219)
@@ -1018,21 +1018,32 @@
           uint64_t data_len;
 
           /**
+          * How much time passed between us asking for this block and
+           * actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown.
+          */
+          struct GNUNET_TIME_Relative block_download_duration;
+
+          /**
           * Depth of the given block in the tree;
           * 0 would be the lowest level (DBLOCKS).
           */
           unsigned int depth;
 
           /**
-          * How much respect did we offer for downloading this block?
+          * How much respect did we offer for downloading this block? 
(estimate,
+          * because we might have the same request pending for multiple 
clients,
+          * and of course because a transmission may have failed at a lower
+          * layer).
           */
-          unsigned int respect_offered;
+          uint32_t respect_offered;
 
           /**
-          * How much time passed between us asking for this block and
-           * actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown.
+          * How often did we transmit the request? (estimate,
+          * because we might have the same request pending for multiple 
clients,
+          * and of course because a transmission may have failed at a lower
+          * layer).
           */
-          struct GNUNET_TIME_Relative block_download_duration;
+          uint32_t num_transmissions;
 
         } progress;
 




reply via email to

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