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;
/**
* Hash map of stats contexts.
*/
-struct GNUNET_CONTAINER_MultiHashMap *stats_map;
+static struct GNUNET_CONTAINER_MultiHashMap *stats_map;
/**
* LL of malicious settings.
/**
* 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.
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);
}
/**
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);
}
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);
}
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. **/
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
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);
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);
}
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;
int ret;
int line_number;
+
config = cfg;
rounds_finished = 0;
memset(&trial_info, 0, sizeof(struct GNUNET_DHTLOG_TrialInfo));
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))
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_free_non_null(trialmessage);
- GNUNET_free(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_non_null(churn_data);
return;
}
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Read %u rounds from churn file\n", churn_rounds);
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);
else /* We don't want this peer! */
{
route_message (find_msg, message_context);
+ GNUNET_free (other_hello);
return;
}
#endif
}
else
{
+ GNUNET_free(recent_hash);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received duplicate find peer request too soon!\n");
}
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));
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);