From: Nathan S. Evans Date: Tue, 12 Oct 2010 10:38:41 +0000 (+0000) Subject: add dht testing option X-Git-Tag: initial-import-from-subversion-38251~20078 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5536faa3b53c26dc40effd5c58c1596b1fd96b43;p=oweals%2Fgnunet.git add dht testing option --- diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c index 4d129b7da..e91b1f04e 100644 --- a/src/dht/gnunet-dht-driver.c +++ b/src/dht/gnunet-dht-driver.c @@ -23,8 +23,7 @@ * then issuing GETS and PUTS on the DHT. Coarse results * are reported, fine grained results (if requested) are * logged to a (mysql) database, or to file. - * - * FIXME: Do churn! + * @author Nathan Evans (who to blame) */ #include "platform.h" #ifndef HAVE_MALICIOUS @@ -427,6 +426,13 @@ static unsigned long long trialuid; */ static unsigned int replicate_same; +/** + * If GNUNET_YES, issue GET requests at the same peers every time. + * Otherwise, choose a new random peer/data combination to search + * each time. + */ +static unsigned int get_from_same; + /** * Number of rounds for testing (PUTS + GETS) */ @@ -1546,8 +1552,11 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) } /* Reset the uid (which item to search for) and the daemon (which peer to search from) for later get request iterations */ - test_get->uid = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_puts); - test_get->daemon = GNUNET_TESTING_daemon_get(pg, GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers)); + if (get_from_same == GNUNET_NO) + { + test_get->uid = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_puts); + test_get->daemon = GNUNET_TESTING_daemon_get(pg, GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers)); + } #if VERBOSE > 1 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%d gets succeeded, %d gets failed!\n", gets_completed, gets_failed); @@ -2807,9 +2816,14 @@ run (void *cls, * Get testing related options. */ if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "DHT_TESTING", "REPLICATE_SAME")) - { - replicate_same = GNUNET_YES; - } + replicate_same = GNUNET_YES; + + /** + * Get testing related options. + */ + if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "DHT_TESTING", "GET_FROM_SAME")) + get_from_same = GNUNET_YES; + if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_time (cfg, "DHT_TESTING", "MALICIOUS_GET_FREQUENCY", @@ -3035,7 +3049,6 @@ run (void *cls, } } - int main (int argc, char *argv[]) {