/*
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
*/
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 */
};
*/
struct GNUNET_FS_DownloadContext *dc;
+ /**
+ * When did we last transmit the request?
+ */
+ struct GNUNET_TIME_Absolute last_transmission;
+
/**
* Number of bytes in data.
*/
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;
};
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);
*
* @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
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)
{
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",
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)
*/
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)
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);
}
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);
*/
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.
*/
*/
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;