*/
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_kademlia, "Messages specific for this msg example");
-extern long unsigned int smx_total_comms;
-
/* Main loop for the process */
static void main_loop(node_t node, double deadline)
{
answer_t node_list;
msg_error_t status;
unsigned int trial = 0;
- unsigned int i, answer_got = 0;
+ unsigned int i;
+ unsigned int answer_got = 0;
/* Add the guy we know to our routing table and ourselves. */
node_routing_table_update(node, node->id);
unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_in_stats)
{
unsigned int i = 0;
- unsigned int queries, answers;
+ unsigned int queries;
+ unsigned int answers;
unsigned int destination_found = 0;
unsigned int nodes_added = 0;
double time_beginreceive;
- double timeout, global_timeout = MSG_get_clock() + find_node_global_timeout;
+ double timeout;
+ double global_timeout = MSG_get_clock() + find_node_global_timeout;
unsigned int steps = 0;
xbt_assert((id_to_find >= 0), "Id supplied incorrect");
*/
unsigned int ping(node_t node, unsigned int id_to_ping)
{
- char mailbox[MAILBOX_NAME_SIZE + 1];
- sprintf(mailbox, "%0*x", MAILBOX_NAME_SIZE, id_to_ping);
+ char mailbox[MAILBOX_NAME_SIZE];
+ snprintf(mailbox,MAILBOX_NAME_SIZE, "%d", id_to_ping);
unsigned int destination_found = 0;
double timeout = MSG_get_clock() + ping_timeout;
*/
void send_find_node(node_t node, unsigned int id, unsigned int destination)
{
- char mailbox[MAILBOX_NAME_SIZE + 1];
+ char mailbox[MAILBOX_NAME_SIZE];
/* Gets the mailbox to send to */
get_node_mailbox(id, mailbox);
/* Build the task */
*/
unsigned int send_find_node_to_best(node_t node, answer_t node_list)
{
- unsigned int i = 0, j = 0;
+ unsigned int i = 0;
+ unsigned int j = 0;
unsigned int destination = node_list->destination_id;
node_contact_t node_to_query;
while (j < kademlia_alpha && i < node_list->size) {
msg_error_t res = MSG_main();
- XBT_CRITICAL("Messages created: %ld", smx_total_comms);
XBT_INFO("Simulated time: %g", MSG_get_clock());
return res != MSG_OK;