Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[doc] @deprecate XBT structures
[simgrid.git] / examples / msg / dht-kademlia / dht-kademlia.c
index 1177377..1b0dc44 100644 (file)
@@ -15,8 +15,6 @@
   */
 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)
 {
@@ -276,8 +274,8 @@ unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_
   */
 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;
@@ -344,7 +342,7 @@ void random_lookup(node_t node)
   */
 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 */
@@ -441,7 +439,6 @@ int main(int argc, char *argv[])
 
   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;