[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12795 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12795 - gnunet/src/dht |
Date: |
Wed, 1 Sep 2010 15:19:43 +0200 |
Author: nevans
Date: 2010-09-01 15:19:43 +0200 (Wed, 01 Sep 2010)
New Revision: 12795
Modified:
gnunet/src/dht/dht_api.c
gnunet/src/dht/gnunet-dht-driver.c
gnunet/src/dht/gnunet-service-dht.c
gnunet/src/dht/plugin_dhtlog_mysql.c
gnunet/src/dht/plugin_dhtlog_mysql_dump.c
gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c
gnunet/src/dht/test_dhtlog.c
Log:
klocwork fixes, dht routing changes (hopefully fixes)
Modified: gnunet/src/dht/dht_api.c
===================================================================
--- gnunet/src/dht/dht_api.c 2010-09-01 13:18:50 UTC (rev 12794)
+++ gnunet/src/dht/dht_api.c 2010-09-01 13:19:43 UTC (rev 12795)
@@ -1087,7 +1087,7 @@
message->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_LOCAL_ROUTE);
memcpy (&message->key, key, sizeof (GNUNET_HashCode));
message->options = htonl (options);
- message->desired_replication_level = htonl (options);
+ message->desired_replication_level = htonl (desired_replication_level);
message->unique_id = GNUNET_htonll (route_handle->uid);
memcpy (&message[1], enc, ntohs (enc->size));
pending = GNUNET_malloc (sizeof (struct PendingMessage));
Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c 2010-09-01 13:18:50 UTC (rev 12794)
+++ gnunet/src/dht/gnunet-dht-driver.c 2010-09-01 13:19:43 UTC (rev 12795)
@@ -51,7 +51,7 @@
#define DEFAULT_PUT_DELAY
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
/* Timeout for waiting for puts to be sent to the service */
-#define DEFAULT_FIND_PEER_DELAY
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 40)
+#define DEFAULT_FIND_PEER_DELAY
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90)
#define DEFAULT_SECONDS_PER_PEER_START
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 45)
@@ -63,7 +63,7 @@
#define DEFAULT_MAX_OUTSTANDING_PUTS 10
-#define DEFAULT_MAX_OUTSTANDING_FIND_PEERS 10
+#define DEFAULT_MAX_OUTSTANDING_FIND_PEERS 5
#define DEFAULT_FIND_PEER_OFFSET GNUNET_TIME_relative_divide
(DEFAULT_FIND_PEER_DELAY, DEFAULT_MAX_OUTSTANDING_FIND_PEERS)
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-09-01 13:18:50 UTC (rev 12794)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-09-01 13:19:43 UTC (rev 12795)
@@ -99,7 +99,7 @@
/**
* Default replication parameter for find peer messages sent by the dht
service.
*/
-#define DHT_DEFAULT_FIND_PEER_REPLICATION 1
+#define DHT_DEFAULT_FIND_PEER_REPLICATION 2
/**
* Default options for find peer requests sent by the dht service.
@@ -153,7 +153,7 @@
* Real maximum number of hops, at which point we refuse
* to forward the message.
*/
-#define MAX_HOPS 20
+#define MAX_HOPS 10
/**
* How many time differences between requesting a core send and
@@ -198,7 +198,6 @@
};
-
/**
* Per-peer information.
*/
@@ -2119,7 +2118,10 @@
remove_recent_find_peer(void *cls, const struct GNUNET_SCHEDULER_TaskContext
*tc)
{
GNUNET_HashCode *key = cls;
- GNUNET_CONTAINER_multihashmap_remove(recent_find_peer_requests, key, key);
+ if (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove(recent_find_peer_requests, key, key))
+ {
+ GNUNET_free(key);
+ }
}
/**
@@ -2142,6 +2144,9 @@
size_t hello_size;
size_t tsize;
GNUNET_HashCode *recent_hash;
+#if RESTRICT_FIND_PEER
+ struct GNUNET_PeerIdentity peer_id;
+#endif
find_peer_message = (struct GNUNET_DHT_FindPeerMessage *)find_msg;
#if DEBUG_DHT
@@ -2175,10 +2180,28 @@
increment_stats("# dht find peer requests ignored (recently seen!)");
return;
}
+
+#if RESTRICT_FIND_PEER
+ /**
+ * Use this check to only allow the peer to respond to find peer requests if
+ * it would be beneficial to have the requesting peer in this peers routing
+ * table. Can be used to thwart peers flooding the network with find peer
+ * requests that we don't care about. However, if a new peer is joining
+ * the network and has no other peers this is a problem (assume all buckets
+ * full, no one will respond!).
+ */
+ memcpy(&peer_id.hashPubKey, &message_context->key, sizeof(GNUNET_HashCode));
+ if (GNUNET_NO == consider_peer(&peer_id))
+ {
+ increment_stats("# dht find peer requests ignored (do not need!)");
+ return;
+ }
+#endif
+
recent_hash = GNUNET_malloc(sizeof(GNUNET_HashCode));
memcpy(recent_hash, &message_context->key, sizeof(GNUNET_HashCode));
GNUNET_CONTAINER_multihashmap_put (recent_find_peer_requests,
&message_context->key, NULL, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
- GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30),
&remove_recent_find_peer, &message_context->key);
+ GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120),
&remove_recent_find_peer, &recent_hash);
/* Simplistic find_peer functionality, always return our hello */
hello_size = ntohs(my_hello->size);
@@ -2325,7 +2348,12 @@
static unsigned int
get_forward_count (unsigned int hop_count, size_t target_replication)
{
+#if DOUBLE
double target_count;
+ double random_probability;
+#else
+ uint32_t random_value;
+#endif
unsigned int target_value;
unsigned int diameter;
@@ -2366,17 +2394,35 @@
#endif
return 0;
}
+
+#if DOUBLE
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Replication %d, hop_count %u,
diameter %u\n", target_replication, hop_count, diameter);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Numerator %f, denominator %f\n",
(double)target_replication, ((double)target_replication * (hop_count + 1) +
diameter));
target_count = /* target_count is ALWAYS < 1 unless replication is < 1 */
(double)target_replication / ((double)target_replication * (hop_count + 1)
+ diameter);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Target count is %f\n", target_count);
+ random_probability = ((double)GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK,
+ RAND_MAX)) / RAND_MAX;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Random is %f\n", random_probability);
target_value = 0;
- while (target_value < target_count)
+ //while (target_value < target_count)
+ if (target_value < target_count)
target_value++; /* target_value is ALWAYS 1 after this "loop", right?
Because target_count is always > 0, right? Or does it become 0.00000... at
some point because the hop count is so high? */
- if ((target_count + 1 - target_value) >
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- RAND_MAX) / RAND_MAX)
+
+ //if ((target_count + 1 - (double)target_value) > random_probability)
+ if ((target_count) > random_probability)
target_value++;
+#endif
+
+ random_value = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK,
target_replication * (hop_count + 1) + diameter) + 1;
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "replication %u, at hop %d, will split
with probability %f\n", target_replication, hop_count, target_replication /
(double)((target_replication * (hop_count + 1) + diameter) + 1));
+ target_value = 1;
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "random %u, target %u, max %u\n",
random_value, target_replication, target_replication * (hop_count + 1) +
diameter);
+ if (random_value < target_replication)
+ target_value++;
+
return target_value;
}
@@ -2776,10 +2822,9 @@
if (message_context->bloom == NULL)
message_context->bloom = GNUNET_CONTAINER_bloomfilter_init (NULL,
DHT_BLOOM_SIZE, DHT_BLOOM_K);
- if ((stop_on_closest == GNUNET_YES) && (message_context->closest ==
GNUNET_YES) && (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DHT_PUT))
+ if ((stop_on_closest == GNUNET_YES) && (global_closest == GNUNET_YES) &&
(ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DHT_PUT))
forward_count = 0;
-
#if DEBUG_DHT_ROUTING
if (forward_count == 0)
ret = GNUNET_SYSERR;
@@ -2804,6 +2849,7 @@
break;
case GNUNET_MESSAGE_TYPE_DHT_PUT: /* Check if closest, if so insert data.
FIXME: thresholding to reduce complexity?*/
increment_stats(STAT_PUTS);
+ message_context->closest = global_closest;
handle_dht_put (cls, msg, message_context);
break;
case GNUNET_MESSAGE_TYPE_DHT_FIND_PEER: /* Check if closest and not
started by us, check options, add to requests seen */
Modified: gnunet/src/dht/plugin_dhtlog_mysql.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql.c 2010-09-01 13:18:50 UTC (rev
12794)
+++ gnunet/src/dht/plugin_dhtlog_mysql.c 2010-09-01 13:19:43 UTC (rev
12795)
@@ -1061,6 +1061,8 @@
*dhtkeyuid = curr_dhtkeyuid;
return GNUNET_OK;
}
+ else if (ret == GNUNET_SYSERR)
+ return GNUNET_SYSERR;
if (GNUNET_OK !=
(ret = prepared_statement_run (insert_dhtkey,
Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-09-01 13:18:50 UTC (rev
12794)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-09-01 13:19:43 UTC (rev
12795)
@@ -203,6 +203,8 @@
return GNUNET_SYSERR;
ret = fprintf(outfile, "execute insert_topology using "
"@date, @num;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
ret = fprintf(outfile, "execute select_topology;\n");
@@ -324,7 +326,8 @@
"@m_gets, @m_puts, @m_drops,"
"@m_g_f, @m_p_f, @s_c, @s_f,"
"@s_k, @g_s, @message;\n");
-
+ if (ret < 0)
+ return GNUNET_SYSERR;
ret = fprintf(outfile, "execute select_trial;\n");
if (ret >= 0)
@@ -357,6 +360,9 @@
else
ret = fprintf(outfile, "set @temp_node = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
ret = fprintf(outfile, "set @temp_section = \"%s\", @temp_stat = \"%s\",
@temp_value = %llu;\n",
section, name, (unsigned long long)value);
@@ -365,6 +371,8 @@
ret = fprintf(outfile, "execute insert_generic_stat;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -411,6 +419,8 @@
ret = fprintf(outfile, "select nodeuid from nodes where trialuid =
@temp_trial and nodeid = \"%s\" into @temp_node;\n",
GNUNET_h2s_full(&peer->hashPubKey));
else
ret = fprintf(outfile, "set @temp_node = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
ret = fprintf(outfile, "set @r_r = %u, @r_f = %u, @res_r = %u, @c_r = %u, "
"@res_f = %u, @gets = %u, @puts = %u, @d_i = %u, "
@@ -431,7 +441,8 @@
"@res_f, @gets, @puts, @d_i, "
"@f_p_r, @f_p_s, @g_s, @p_s, "
"@f_p_r_r, @g_r_r, @f_p_r_s, @g_r_s;\n");
-
+ if (ret < 0)
+ return GNUNET_SYSERR;
return GNUNET_OK;
}
/*
@@ -663,11 +674,17 @@
else
ret = fprintf(outfile, "set @temp_dhtkey = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
if (node != NULL)
ret = fprintf(outfile, "select nodeuid from nodes where trialuid =
@temp_trial and nodeid = \"%s\" into @temp_node;\n",
GNUNET_h2s_full(&node->hashPubKey));
else
ret = fprintf(outfile, "set @temp_node = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
ret = fprintf(outfile, "set @qid = %llu, @type = %u, @hops = %u, @succ =
%d;\n", queryid, type, hops, succeeded);
if (ret < 0)
@@ -716,21 +733,33 @@
else
ret = fprintf(outfile, "set @temp_dhtkey = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
if (node != NULL)
ret = fprintf(outfile, "select nodeuid from nodes where trialuid =
@temp_trial and nodeid = \"%s\" into @temp_node;\n",
GNUNET_h2s_full(&node->hashPubKey));
else
ret = fprintf(outfile, "set @temp_node = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
if (from_node != NULL)
ret = fprintf(outfile, "select nodeuid from nodes where trialuid =
@temp_trial and nodeid = \"%s\" into @temp_from_node;\n",
GNUNET_h2s_full(&from_node->hashPubKey));
else
ret = fprintf(outfile, "set @temp_from_node = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
if (to_node != NULL)
ret = fprintf(outfile, "select nodeuid from nodes where trialuid =
@temp_trial and nodeid = \"%s\" into @temp_to_node;\n",
GNUNET_h2s_full(&to_node->hashPubKey));
else
ret = fprintf(outfile, "set @temp_to_node = 0;\n");
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
ret = fprintf(outfile, "set @qid = %llu, @type = %u, @hops = %u, @succ =
%d;\n", queryid, type, hops, succeeded);
if (ret < 0)
@@ -780,6 +809,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
outfile = FOPEN (fn, "w");
Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c 2010-09-01 13:18:50 UTC
(rev 12794)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c 2010-09-01 13:19:43 UTC
(rev 12795)
@@ -101,6 +101,8 @@
return GNUNET_SYSERR;
ret = fprintf(outfile, "insert into topology (trialuid, date, connections)
values (@temp_trial, \"%s\", %d);\n", get_sql_time(), num_connections);
+ if (ret < 0)
+ return GNUNET_SYSERR;
ret = fprintf(outfile, "select max(topology_uid) from topology into
@temp_topology;\n");
if (ret >= 0)
return GNUNET_OK;
@@ -123,6 +125,8 @@
return GNUNET_SYSERR;
ret = fprintf(extended_topology_outfile, "insert into extended_topology
(topology_uid, uid_first, uid_second) values (%u, %s,", topology_count,
GNUNET_h2s_full(&first->hashPubKey));
+ if (ret < 0)
+ return GNUNET_SYSERR;
ret = fprintf(extended_topology_outfile, "%s);\n",
GNUNET_h2s_full(&second->hashPubKey));
if (ret >= 0)
@@ -197,11 +201,15 @@
malicious_droppers, malicious_get_frequency,
malicious_put_frequency,
stop_closest, stop_found, strict_kademlia,
gets_succeeded, message);
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
ret = fprintf(outfile, "SELECT MAX( trialuid ) FROM trials into
@temp_trial;\n");
if (ret >= 0)
return GNUNET_OK;
- return GNUNET_SYSERR;
+ else
+ return GNUNET_SYSERR;
}
@@ -278,10 +286,13 @@
get_responses_received,
find_peer_responses_sent,
get_responses_sent);
- if (ret < 0)
+ else
return GNUNET_SYSERR;
- return GNUNET_OK;
+ if (ret >= 0)
+ return GNUNET_OK;
+ else
+ return GNUNET_SYSERR;
}
/*
* Inserts the specified dhtkey into the dhttests.dhtkeys table,
@@ -299,15 +310,15 @@
if (dhtkeyuid != NULL)
*dhtkeyuid = 0;
- if (dhtkey_outfile == NULL)
+ if ((dhtkey_outfile == NULL) || (dhtkey == NULL))
return GNUNET_SYSERR;
- if (dhtkey != NULL)
- ret = fprintf(dhtkey_outfile, "TRIALUID\t%s\n", GNUNET_h2s_full(dhtkey));
+ ret = fprintf(dhtkey_outfile, "TRIALUID\t%s\n", GNUNET_h2s_full(dhtkey));
if (ret >= 0)
return GNUNET_OK;
- return GNUNET_SYSERR;
+ else
+ return GNUNET_SYSERR;
}
/*
@@ -471,6 +482,10 @@
*sqlqueryuid = 0;
ret = fprintf(query_outfile, "TRIALUID\t%s\t", GNUNET_h2s_full(key));
+
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
ret = fprintf(query_outfile, "%s\t%llu\t%u\t%u\t%u\n",
GNUNET_h2s_full(&node->hashPubKey), queryid, type, hops, succeeded);
if (ret >= 0)
@@ -510,11 +525,18 @@
*sqlqueryuid = 0;
ret = fprintf(route_outfile, "TRIALUID\t%s\t", GNUNET_h2s_full(key));
+ if (ret < 0)
+ return GNUNET_SYSERR;
+
ret = fprintf(route_outfile, "%s\t", GNUNET_h2s_full(&node->hashPubKey));
+ if (ret < 0)
+ return GNUNET_SYSERR;
if (from_node == NULL)
ret = fprintf(route_outfile, "0\t");
else
ret = fprintf(route_outfile, "%s\t",
GNUNET_h2s_full(&from_node->hashPubKey));
+ if (ret < 0)
+ return GNUNET_SYSERR;
if (to_node == NULL)
ret = fprintf(route_outfile, "0\t%llu\t%u\t%u\t%d\n", queryid, type, hops,
succeeded);
@@ -563,6 +585,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
outfile = FOPEN (fn, "w");
@@ -587,6 +617,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
node_outfile = FOPEN (fn, "w");
@@ -611,6 +649,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
route_outfile = FOPEN (fn, "w");
@@ -635,6 +681,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
query_outfile = FOPEN (fn, "w");
@@ -659,6 +713,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
stat_outfile = FOPEN (fn, "w");
@@ -683,6 +745,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
generic_stat_outfile = FOPEN (fn, "w");
@@ -707,6 +777,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
dhtkey_outfile = FOPEN (fn, "w");
@@ -731,6 +809,14 @@
fn = GNUNET_STRINGS_filename_expand (outfile_name);
+ if (fn == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to get full path for
`%s'\n"), outfile_name);
+ GNUNET_free(outfile_path);
+ GNUNET_free(outfile_name);
+ return NULL;
+ }
+
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
extended_topology_outfile = FOPEN (fn, "w");
Modified: gnunet/src/dht/test_dhtlog.c
===================================================================
--- gnunet/src/dht/test_dhtlog.c 2010-09-01 13:18:50 UTC (rev 12794)
+++ gnunet/src/dht/test_dhtlog.c 2010-09-01 13:19:43 UTC (rev 12795)
@@ -72,37 +72,52 @@
ret = api->insert_topology(500);
CHECK(ret);
ret = api->insert_node (&nodeuid, &p1);
+ CHECK(ret);
ret = api->insert_node (&nodeuid, &p2);
+ CHECK(ret);
ret = api->insert_node (&nodeuid, &p3);
+ CHECK(ret);
ret = api->insert_node (&nodeuid, &p4);
+ CHECK(ret);
ret = api->set_malicious(&p1);
CHECK(ret);
ret = api->insert_topology(0);
+ CHECK(ret);
ret = api->insert_extended_topology(&p1, &p2);
+ CHECK(ret);
ret = api->insert_extended_topology(&p3, &p4);
+ CHECK(ret);
ret = api->update_topology(101);
CHECK(ret);
ret = api->insert_dhtkey (&dhtkeyuid, &k1);
+ CHECK(ret);
ret = api->insert_dhtkey (&dhtkeyuid, &k2);
CHECK(ret);
ret = api->insert_query (&sqlqueryuid, internaluid, 2, 4, 0, &p2, &k1);
+ CHECK(ret);
ret =
api->insert_route (&sqlrouteuid, sqlqueryuid, 1, 1, DHTLOG_GET, &p1, &k2,
&p4, &p3);
+ CHECK(ret);
ret =
api->insert_route (&sqlrouteuid, sqlqueryuid, 2, 0, DHTLOG_PUT, &p3, &k1,
&p4, &p2);
+ CHECK(ret);
ret =
api->insert_route (&sqlrouteuid, sqlqueryuid, 3, 1, DHTLOG_ROUTE, &p3, &k2,
&p2, NULL);
+ CHECK(ret);
ret =
api->insert_route (&sqlrouteuid, sqlqueryuid, 4, 7, DHTLOG_ROUTE, &p3, &k2,
NULL, NULL);
+ CHECK(ret);
sleep (1);
ret = api->insert_stat(&p1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17);
+ CHECK(ret);
ret = api->insert_stat(&p2, 12, 23, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27);
CHECK(ret);
ret = api->update_trial (trialuid, 787);
+ CHECK(ret);
ret = api->add_generic_stat (&p2, "nonsense", "section", 77765);
CHECK(ret);
return 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12795 - gnunet/src/dht,
gnunet <=