[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13639 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13639 - gnunet/src/dht |
Date: |
Wed, 10 Nov 2010 13:39:32 +0100 |
Author: nevans
Date: 2010-11-10 13:39:32 +0100 (Wed, 10 Nov 2010)
New Revision: 13639
Modified:
gnunet/src/dht/dht_api.c
gnunet/src/dht/dht_api_get_put.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
Log:
codesonar fixes
Modified: gnunet/src/dht/dht_api.c
===================================================================
--- gnunet/src/dht/dht_api.c 2010-11-10 12:37:44 UTC (rev 13638)
+++ gnunet/src/dht/dht_api.c 2010-11-10 12:39:32 UTC (rev 13639)
@@ -555,7 +555,7 @@
GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
{
struct PendingMessage *pm;
-
+ GNUNET_assert(handle != NULL);
GNUNET_assert (0 ==
GNUNET_CONTAINER_multihashmap_size(handle->active_requests));
if (handle->th != NULL)
{
Modified: gnunet/src/dht/dht_api_get_put.c
===================================================================
--- gnunet/src/dht/dht_api_get_put.c 2010-11-10 12:37:44 UTC (rev 13638)
+++ gnunet/src/dht/dht_api_get_put.c 2010-11-10 12:39:32 UTC (rev 13639)
@@ -247,6 +247,9 @@
* Stop async DHT-get.
*
* @param get_handle handle to the GET operation to stop
+ *
+ * On return get_handle will no longer be valid, caller
+ * must not use again!!!
*/
void
GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle)
Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c 2010-11-10 12:37:44 UTC (rev 13638)
+++ gnunet/src/dht/gnunet-dht-driver.c 2010-11-10 12:39:32 UTC (rev 13639)
@@ -414,8 +414,6 @@
static unsigned long long settle_time;
-static unsigned long long trial_to_run;
-
static struct GNUNET_DHTLOG_Handle *dhtlog_handle;
static unsigned long long trialuid;
@@ -466,7 +464,7 @@
/**
* Hash map of stats contexts.
*/
-struct GNUNET_CONTAINER_MultiHashMap *stats_map;
+static struct GNUNET_CONTAINER_MultiHashMap *stats_map;
/**
* LL of malicious settings.
@@ -507,7 +505,7 @@
/**
* Global config handle.
*/
-const struct GNUNET_CONFIGURATION_Handle *config;
+static const struct GNUNET_CONFIGURATION_Handle *config;
/**
* Total number of peers to run, set based on config file.
@@ -693,8 +691,8 @@
static void
free_meter(struct ProgressMeter *meter)
{
- GNUNET_free_non_null(meter->startup_string);
- GNUNET_free_non_null(meter);
+ GNUNET_free_non_null (meter->startup_string);
+ GNUNET_free (meter);
}
/**
@@ -1125,6 +1123,7 @@
if (GNUNET_CONTAINER_multihashmap_contains(find_peer_context->peer_hash,
&first->hashPubKey))
{
first_count =
GNUNET_CONTAINER_multihashmap_get(find_peer_context->peer_hash,
&first->hashPubKey);
+ GNUNET_assert(first_count != NULL);
first_count->count++;
GNUNET_CONTAINER_heap_update_cost(find_peer_context->peer_min_heap,
first_count->heap_node, first_count->count);
}
@@ -1140,6 +1139,7 @@
if (GNUNET_CONTAINER_multihashmap_contains(find_peer_context->peer_hash,
&second->hashPubKey))
{
second_count =
GNUNET_CONTAINER_multihashmap_get(find_peer_context->peer_hash,
&second->hashPubKey);
+ GNUNET_assert(second_count != NULL);
second_count->count++;
GNUNET_CONTAINER_heap_update_cost(find_peer_context->peer_min_heap,
second_count->heap_node, second_count->count);
}
@@ -1179,10 +1179,12 @@
if (cost == 0)
{
d1 = GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id);
+ GNUNET_assert(d1 != NULL);
d2 = d1;
while ((d2 == d1) || (GNUNET_YES != GNUNET_TESTING_daemon_running(d2)))
{
d2 = GNUNET_TESTING_daemon_get(pg,
GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers));
+ GNUNET_assert(d2 != NULL);
}
/** Just try to connect the peers, don't worry about callbacks, etc. **/
@@ -1233,7 +1235,7 @@
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Peer count finished (%u
connections)\n",
find_peer_context->current_peers);
peer_count =
GNUNET_CONTAINER_heap_peek(find_peer_context->peer_min_heap);
-
+ GNUNET_assert(peer_count != NULL);
/* WAIT. When peers are churned they will come back with their peers (at
least in peerinfo), because the HOSTS file doesn't likely get removed. CRAP. */
/* NO they won't, because we have disabled peerinfo writing to disk
(remember?) so we WILL have to give them new connections */
/* Best course of action: have DHT automatically try to add peers from
peerinfo on startup. This way IF peerinfo writes to file
@@ -1363,6 +1365,7 @@
test_find_peer = GNUNET_malloc(sizeof(struct TestFindPeer));
/* If we have sent requests, choose peers with a low number of
connections to send requests from */
peer_count =
GNUNET_CONTAINER_heap_remove_root(find_peer_ctx->peer_min_heap);
+ GNUNET_assert(peer_count != NULL);
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Sending find peer request from
peer with %u connections\n", peer_count->count);
GNUNET_CONTAINER_multihashmap_remove(find_peer_ctx->peer_hash,
&peer_count->peer_id.hashPubKey, peer_count);
test_find_peer->daemon = GNUNET_TESTING_daemon_get_by_id(pg,
&peer_count->peer_id);
@@ -1902,10 +1905,10 @@
connection_estimate(num_peers,
DEFAULT_BUCKET_SIZE),
2 * connection_estimate(num_peers,
DEFAULT_BUCKET_SIZE));
- if ((find_peer_context->last_sent > 8) &&
- (find_peer_context->current_peers -
find_peer_context->previous_peers > FIND_PEER_THRESHOLD) &&
+ if ((find_peer_context->last_sent < 8) ||
+ ((find_peer_context->current_peers -
find_peer_context->previous_peers > FIND_PEER_THRESHOLD) &&
(find_peer_context->current_peers < 2 *
connection_estimate(num_peers, DEFAULT_BUCKET_SIZE)) &&
-
(GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).rel_value > 0))
+
(GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).rel_value > 0)))
{
GNUNET_SCHEDULER_add_now(&schedule_find_peer_requests,
find_peer_context);
}
@@ -2469,6 +2472,7 @@
char *hostfile;
float topology_probability;
unsigned long long temp_config_number;
+ unsigned long long trial_to_run;
int stop_closest;
int stop_found;
int strict_kademlia;
@@ -2480,6 +2484,7 @@
int ret;
int line_number;
+
config = cfg;
rounds_finished = 0;
memset(&trial_info, 0, sizeof(struct GNUNET_DHTLOG_TrialInfo));
@@ -2533,6 +2538,8 @@
if (GNUNET_OK != GNUNET_DISK_file_test (churn_filename))
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Error reading churn file!\n");
+ GNUNET_free_non_null(trialmessage);
+ GNUNET_free(churn_filename);
return;
}
if ((0 != STAT (churn_filename, &frstat)) || (frstat.st_size == 0))
@@ -2571,10 +2578,10 @@
churn_data[count] = '\0';
if (1 != sscanf(buf, "%u", &churn_rounds))
{
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to read number
of rounds from %s, ending test!\n", churn_filename);
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to read number
of rounds from churn file, ending test!\n");
+ ret = 4200;
GNUNET_free_non_null(trialmessage);
- GNUNET_free(churn_filename);
- ret = 4200;
+ GNUNET_free_non_null(churn_data);
return;
}
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Read %u rounds from churn
file\n", churn_rounds);
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-11-10 12:37:44 UTC (rev 13638)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-11-10 12:39:32 UTC (rev 13639)
@@ -1672,7 +1672,7 @@
size_t psize;
increment_stats(STAT_ROUTE_FORWARDS);
-
+ GNUNET_assert(peer != NULL);
if ((msg_ctx->closest != GNUNET_YES) && (peer ==
find_closest_peer(&msg_ctx->key)))
increment_stats(STAT_ROUTE_FORWARDS_CLOSEST);
@@ -2434,6 +2434,7 @@
else /* We don't want this peer! */
{
route_message (find_msg, message_context);
+ GNUNET_free (other_hello);
return;
}
#endif
@@ -2512,6 +2513,7 @@
}
else
{
+ GNUNET_free(recent_hash);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received duplicate find peer
request too soon!\n");
}
@@ -3912,7 +3914,6 @@
get_message.header.type = htons(GNUNET_MESSAGE_TYPE_DHT_GET);
get_message.type = htonl(GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE);
memset(&message_context, 0, sizeof(struct DHT_MessageContext));
- message_context.client = NULL;
random_key = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK,
(uint32_t)-1);
GNUNET_CRYPTO_hash(&random_key, sizeof(uint32_t), &key);
memcpy(&message_context.key, &key, sizeof(GNUNET_HashCode));
@@ -4539,6 +4540,7 @@
increment_stats(STAT_DISCONNECTS);
GNUNET_assert(GNUNET_CONTAINER_multihashmap_contains(all_known_peers,
&peer->hashPubKey));
to_remove = GNUNET_CONTAINER_multihashmap_get(all_known_peers,
&peer->hashPubKey);
+ GNUNET_assert (to_remove != NULL);
GNUNET_assert(0 == memcmp(peer, &to_remove->id, sizeof(struct
GNUNET_PeerIdentity)));
current_bucket = find_current_bucket(&to_remove->id.hashPubKey);
delete_peer(to_remove, current_bucket);
Modified: gnunet/src/dht/plugin_dhtlog_mysql.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql.c 2010-11-10 12:37:44 UTC (rev
13638)
+++ gnunet/src/dht/plugin_dhtlog_mysql.c 2010-11-10 12:39:32 UTC (rev
13639)
@@ -1356,8 +1356,6 @@
if (from_node != NULL)
get_node_uid (&from_uid, &from_node->hashPubKey);
- else
- from_uid = 0;
if (to_node != NULL)
get_node_uid (&to_uid, &to_node->hashPubKey);
@@ -1456,9 +1454,8 @@
}
if (ret > 0)
return GNUNET_OK;
- else
- return GNUNET_SYSERR;
- return GNUNET_OK;
+ return GNUNET_SYSERR;
+
}
/*
@@ -1487,9 +1484,7 @@
}
if (ret > 0)
return GNUNET_OK;
- else
- return GNUNET_SYSERR;
- return GNUNET_OK;
+ return GNUNET_SYSERR;
}
/*
@@ -1535,9 +1530,7 @@
}
if (ret > 0)
return GNUNET_OK;
- else
- return GNUNET_SYSERR;
- return GNUNET_OK;
+ return GNUNET_SYSERR;
}
Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-11-10 12:37:44 UTC (rev
13638)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-11-10 12:39:32 UTC (rev
13639)
@@ -490,10 +490,7 @@
if (outfile == NULL)
return GNUNET_SYSERR;
- if (node != NULL)
- ret = fprintf(outfile, "set @node = \"%s\";\n",
GNUNET_h2s_full(&node->hashPubKey));
- else
- return GNUNET_SYSERR;
+ ret = fprintf(outfile, "set @node = \"%s\";\n",
GNUNET_h2s_full(&node->hashPubKey));
if (ret < 0)
return GNUNET_SYSERR;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13639 - gnunet/src/dht,
gnunet <=