A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
please sonar: dont apply binary operators to signed ints
[simgrid.git]
/
examples
/
msg
/
dht-kademlia
/
dht-kademlia.c
diff --git
a/examples/msg/dht-kademlia/dht-kademlia.c
b/examples/msg/dht-kademlia/dht-kademlia.c
index
1177377
..
ad73ec1
100644
(file)
--- a/
examples/msg/dht-kademlia/dht-kademlia.c
+++ b/
examples/msg/dht-kademlia/dht-kademlia.c
@@
-15,8
+15,6
@@
*/
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_kademlia, "Messages specific for this msg example");
*/
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)
{
/* Main loop for the process */
static void main_loop(node_t node, double deadline)
{
@@
-114,7
+112,8
@@
unsigned int join(node_t node, unsigned int id_known)
answer_t node_list;
msg_error_t status;
unsigned int trial = 0;
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);
/* Add the guy we know to our routing table and ourselves. */
node_routing_table_update(node, node->id);
@@
-180,11
+179,13
@@
unsigned int join(node_t node, unsigned int id_known)
unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_in_stats)
{
unsigned int i = 0;
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;
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 steps = 0;
xbt_assert((id_to_find >= 0), "Id supplied incorrect");
@@
-276,8
+277,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)
{
*/
unsigned int ping(node_t node, unsigned int id_to_ping)
{
- char mailbox[MAILBOX_NAME_SIZE
+ 1
];
- s
printf(mailbox, "%0*x", MAILBOX_NAME_SIZE
, id_to_ping);
+ char mailbox[MAILBOX_NAME_SIZE];
+ s
nprintf(mailbox,MAILBOX_NAME_SIZE, "%d"
, id_to_ping);
unsigned int destination_found = 0;
double timeout = MSG_get_clock() + ping_timeout;
unsigned int destination_found = 0;
double timeout = MSG_get_clock() + ping_timeout;
@@
-344,7
+345,7
@@
void random_lookup(node_t node)
*/
void send_find_node(node_t node, unsigned int id, unsigned int destination)
{
*/
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 */
/* Gets the mailbox to send to */
get_node_mailbox(id, mailbox);
/* Build the task */
@@
-360,7
+361,8
@@
void send_find_node(node_t node, unsigned int id, unsigned int destination)
*/
unsigned int send_find_node_to_best(node_t node, answer_t node_list)
{
*/
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) {
unsigned int destination = node_list->destination_id;
node_contact_t node_to_query;
while (j < kademlia_alpha && i < node_list->size) {
@@
-441,7
+443,6
@@
int main(int argc, char *argv[])
msg_error_t res = MSG_main();
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;
XBT_INFO("Simulated time: %g", MSG_get_clock());
return res != MSG_OK;