return;
}
/* Put size is actual data size plus struct overhead plus path length (if any) */
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# ITEMS stored in datacache"), 1,
+ GNUNET_NO);
pe = (struct DHTPutEntry *) buf;
pe->data_size = htons (data_size);
pe->path_length = htons ((uint16_t) put_path_length);
*/
uint32_t reply_bf_mutator;
+ /**
+ * Return value to give back.
+ */
+ enum GNUNET_BLOCK_EvaluationResult eval;
};
ctx->xquery_size,
rdata,
rdata_size);
+ ctx->eval = eval;
switch (eval)
{
case GNUNET_BLOCK_EVALUATION_OK_LAST:
case GNUNET_BLOCK_EVALUATION_OK_MORE:
/* forward to local clients */
- GDS_CLIENT_handle_reply (exp,
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# Good RESULTS found in datacache"), 1,
+ GNUNET_NO);
+ GDS_CLIENTS_handle_reply (exp,
key,
0, NULL,
put_path_length, pp,
0, NULL, rdata, rdata_size);
break;
case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# Duplicate RESULTS found in datacache"), 1,
+ GNUNET_NO);
break;
case GNUNET_BLOCK_EVALUATION_RESULT_INVALID:
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# Invalid RESULTS found in datacache"), 1,
+ GNUNET_NO);
break;
case GNUNET_BLOCK_EVALUATION_REQUEST_VALID:
GNUNET_break (0);
GNUNET_break_op (0);
return GNUNET_SYSERR;
case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED:
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# Unsupported RESULTS found in datacache"), 1,
+ GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unsupported block type (%u) in local response!\n",
type);
break;
}
- return GNUNET_OK;
+ return (eval == GNUNET_BLOCK_EVALUATION_OK_LAST) ? GNUNET_NO : GNUNET_OK;
}
* @param xquery_size number of bytes in xquery
* @param reply_bf where the reply bf is (to be) stored, possibly updated, can be NULL
* @param reply_bf_mutator mutation value for reply_bf
+ * @return evaluation result for the local replies
*/
-void
+enum GNUNET_BLOCK_EvaluationResult
GDS_DATACACHE_handle_get (const GNUNET_HashCode *key,
enum GNUNET_BLOCK_Type type,
const void *xquery,
struct GetRequestContext ctx;
if (datacache == NULL)
- return;
+ return GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# GET requests given to datacache"), 1,
+ GNUNET_NO);
+ ctx.eval = GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
ctx.key = *key;
ctx.xquery = xquery;
ctx.xquery_size = xquery_size;
ctx.reply_bf_mutator = reply_bf_mutator;
(void) GNUNET_DATACACHE_get (datacache, key, type,
&datacache_get_iterator, &ctx);
+ return ctx.eval;
}