aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-09-16 15:20:40 +0000
committerNathan S. Evans <evans@in.tum.de>2010-09-16 15:20:40 +0000
commit4e401e3ef3ed0027275f366c11f5b67df52ef67d (patch)
treee15dd08887d79368f942c4b1c3c2ea76843e3c0f /src
parenta2b46552b7f2cf112bc0f65f0c2e2f1936df98be (diff)
downloadgnunet-4e401e3ef3ed0027275f366c11f5b67df52ef67d.tar.gz
gnunet-4e401e3ef3ed0027275f366c11f5b67df52ef67d.zip
debug messages in driver, correct time (even for mysql_dump), change dhtlog testcase so it doesn't leave files after running
Diffstat (limited to 'src')
-rw-r--r--src/dht/gnunet-dht-driver.c23
-rw-r--r--src/dht/plugin_dhtlog_mysql.c4
-rw-r--r--src/dht/plugin_dhtlog_mysql_dump.c8
-rw-r--r--src/dht/plugin_dhtlog_mysql_dump_load.c2
-rw-r--r--src/dht/test_dhtlog_data.conf4
5 files changed, 24 insertions, 17 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c
index cdd5e7c16..e343e911f 100644
--- a/src/dht/gnunet-dht-driver.c
+++ b/src/dht/gnunet-dht-driver.c
@@ -1305,7 +1305,7 @@ void count_peers_churn_cb (void *cls,
1305 */ 1305 */
1306 if ((peer_count->count == 0) && (GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).value > 0)) 1306 if ((peer_count->count == 0) && (GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).value > 0))
1307 { 1307 {
1308 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Found peer with no connections, will choose some peers at random to connect to!\n"); 1308 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Found peer with no connections, will choose some peer(s) at random to connect to!\n");
1309 GNUNET_CONTAINER_heap_iterate (find_peer_context->peer_min_heap, &iterate_min_heap_peers, find_peer_context); 1309 GNUNET_CONTAINER_heap_iterate (find_peer_context->peer_min_heap, &iterate_min_heap_peers, find_peer_context);
1310 GNUNET_SCHEDULER_add_now(sched, &schedule_churn_find_peer_requests, find_peer_context); 1310 GNUNET_SCHEDULER_add_now(sched, &schedule_churn_find_peer_requests, find_peer_context);
1311 } 1311 }
@@ -1368,6 +1368,7 @@ static void churn_complete (void *cls, const char *emsg)
1368 */ 1368 */
1369 if (find_peer_context != NULL) 1369 if (find_peer_context != NULL)
1370 { 1370 {
1371 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "We have churned on some peers, so we must schedule find peer requests for them!\n");
1371 for (i = 0; i < num_peers; i ++) 1372 for (i = 0; i < num_peers; i ++)
1372 { 1373 {
1373 temp_daemon = GNUNET_TESTING_daemon_get(pg, i); 1374 temp_daemon = GNUNET_TESTING_daemon_get(pg, i);
@@ -1380,6 +1381,7 @@ static void churn_complete (void *cls, const char *emsg)
1380 } 1381 }
1381 else 1382 else
1382 { 1383 {
1384 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Only churned off peers, no find peer requests, scheduling more gets...\n");
1383 if (dhtlog_handle != NULL) 1385 if (dhtlog_handle != NULL)
1384 { 1386 {
1385 topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext)); 1387 topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext));
@@ -1988,12 +1990,17 @@ continue_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext * t
1988 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time), &setup_puts_and_gets, NULL); 1990 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time), &setup_puts_and_gets, NULL);
1989 1991
1990 if (GNUNET_YES == do_find_peer) 1992 if (GNUNET_YES == do_find_peer)
1991 { 1993 {
1992 find_peer_context = GNUNET_malloc(sizeof(struct FindPeerContext)); 1994 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Scheduling find peer requests during \"settle\" time.\n");
1993 find_peer_context->count_peers_cb = &count_peers_cb; 1995 find_peer_context = GNUNET_malloc(sizeof(struct FindPeerContext));
1994 find_peer_context->endtime = GNUNET_TIME_relative_to_absolute(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time)); 1996 find_peer_context->count_peers_cb = &count_peers_cb;
1995 GNUNET_SCHEDULER_add_now(sched, &schedule_find_peer_requests, find_peer_context); 1997 find_peer_context->endtime = GNUNET_TIME_relative_to_absolute(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time));
1996 } 1998 GNUNET_SCHEDULER_add_now(sched, &schedule_find_peer_requests, find_peer_context);
1999 }
2000 else
2001 {
2002 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Assuming automatic DHT find peer requests.\n");
2003 }
1997} 2004}
1998 2005
1999/** 2006/**
@@ -2432,7 +2439,7 @@ run (void *cls,
2432 churn_data = NULL; 2439 churn_data = NULL;
2433 /** Check for a churn file to do churny simulation */ 2440 /** Check for a churn file to do churny simulation */
2434 if (GNUNET_OK == 2441 if (GNUNET_OK ==
2435 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "churn_file", 2442 GNUNET_CONFIGURATION_get_value_string(cfg, "dht_testing", "churn_file",
2436 &churn_filename)) 2443 &churn_filename))
2437 { 2444 {
2438 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Reading churn data from %s\n", churn_filename); 2445 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Reading churn data from %s\n", churn_filename);
diff --git a/src/dht/plugin_dhtlog_mysql.c b/src/dht/plugin_dhtlog_mysql.c
index 465a987e0..b31a41f4c 100644
--- a/src/dht/plugin_dhtlog_mysql.c
+++ b/src/dht/plugin_dhtlog_mysql.c
@@ -91,8 +91,8 @@ static unsigned long long current_trial = 0; /* I like to assign 0, just to r
91 */ 91 */
92static MYSQL *conn; 92static MYSQL *conn;
93 93
94#define INSERT_QUERIES_STMT "INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid) "\ 94#define INSERT_QUERIES_STMT "INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, time) "\
95 "VALUES (?, ?, ?, ?, ?, ?, ?)" 95 "VALUES (?, ?, ?, ?, ?, ?, ?, NOW())"
96static struct StatementHandle *insert_query; 96static struct StatementHandle *insert_query;
97 97
98#define INSERT_ROUTES_STMT "INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\ 98#define INSERT_ROUTES_STMT "INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\
diff --git a/src/dht/plugin_dhtlog_mysql_dump.c b/src/dht/plugin_dhtlog_mysql_dump.c
index 2582bca41..8b16c155d 100644
--- a/src/dht/plugin_dhtlog_mysql_dump.c
+++ b/src/dht/plugin_dhtlog_mysql_dump.c
@@ -51,8 +51,8 @@ static unsigned long max_varchar_len;
51 */ 51 */
52static const struct GNUNET_CONFIGURATION_Handle *cfg; 52static const struct GNUNET_CONFIGURATION_Handle *cfg;
53 53
54#define INSERT_QUERIES_STMT "prepare insert_query from 'INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid) "\ 54#define INSERT_QUERIES_STMT "prepare insert_query from 'INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, time) "\
55 "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?)'" 55 "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?, ?)'"
56 56
57#define INSERT_ROUTES_STMT "prepare insert_route from 'INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\ 57#define INSERT_ROUTES_STMT "prepare insert_route from 'INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\
58 "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?, ?, ?)'" 58 "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?, ?, ?)'"
@@ -678,12 +678,12 @@ add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
678 if (ret < 0) 678 if (ret < 0)
679 return GNUNET_SYSERR; 679 return GNUNET_SYSERR;
680 680
681 ret = fprintf(outfile, "set @qid = %llu, @type = %u, @hops = %u, @succ = %d;\n", queryid, type, hops, succeeded); 681 ret = fprintf(outfile, "set @qid = %llu, @type = %u, @hops = %u, @succ = %d, @time = \"%s\";\n", queryid, type, hops, succeeded, get_sql_time());
682 682
683 if (ret < 0) 683 if (ret < 0)
684 return GNUNET_SYSERR; 684 return GNUNET_SYSERR;
685 685
686 ret = fprintf(outfile, "execute insert_query using @type, @hops, @temp_dhtkey, @qid, @succ, @temp_node;\n"); 686 ret = fprintf(outfile, "execute insert_query using @type, @hops, @temp_dhtkey, @qid, @succ, @temp_node, @time;\n");
687 687
688 if (ret >= 0) 688 if (ret >= 0)
689 return GNUNET_OK; 689 return GNUNET_OK;
diff --git a/src/dht/plugin_dhtlog_mysql_dump_load.c b/src/dht/plugin_dhtlog_mysql_dump_load.c
index e1c1e6580..ac4b91301 100644
--- a/src/dht/plugin_dhtlog_mysql_dump_load.c
+++ b/src/dht/plugin_dhtlog_mysql_dump_load.c
@@ -475,7 +475,7 @@ add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
475 if (ret < 0) 475 if (ret < 0)
476 return GNUNET_SYSERR; 476 return GNUNET_SYSERR;
477 477
478 ret = fprintf(query_outfile, "%s\t%llu\t%u\t%u\t%u\n", GNUNET_h2s_full(&node->hashPubKey), queryid, type, hops, succeeded); 478 ret = fprintf(query_outfile, "%s\t%llu\t%u\t%u\t%u\t%s\n", GNUNET_h2s_full(&node->hashPubKey), queryid, type, hops, succeeded, get_sql_time());
479 479
480 if (ret >= 0) 480 if (ret >= 0)
481 return GNUNET_OK; 481 return GNUNET_OK;
diff --git a/src/dht/test_dhtlog_data.conf b/src/dht/test_dhtlog_data.conf
index 2cb9af38a..22ef427aa 100644
--- a/src/dht/test_dhtlog_data.conf
+++ b/src/dht/test_dhtlog_data.conf
@@ -36,8 +36,8 @@ DEFAULTCONFIG = test_dhtlog_data.conf
36SERVICEHOME = /tmp/test-dhtlog/ 36SERVICEHOME = /tmp/test-dhtlog/
37 37
38[DHTLOG] 38[DHTLOG]
39PLUGIN = mysql_dump 39#PLUGIN = mysql_dump
40#PLUGIN = dummy 40PLUGIN = dummy
41#PLUGIN = mysql 41#PLUGIN = mysql
42 42
43[MYSQL] 43[MYSQL]