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
Fix kademlia node sort
[simgrid.git]
/
examples
/
msg
/
kademlia
/
answer.c
diff --git
a/examples/msg/kademlia/answer.c
b/examples/msg/kademlia/answer.c
index
4eb095f
..
712b6fa
100644
(file)
--- a/
examples/msg/kademlia/answer.c
+++ b/
examples/msg/kademlia/answer.c
@@
-78,7
+78,13
@@
static int _answer_sort_function(const void *e1, const void *e2)
{
node_contact_t c1 = *(void **) e1;
node_contact_t c2 = *(void **) e2;
- return c1->distance >= c2->distance;
+ if (c1->distance == c2->distance)
+ return 0;
+ else
+ if (c1->distance < c2->distance)
+ return -1;
+ else
+ return 1;
}
/**