Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Dig through git history, and update copyright lines.
[simgrid.git] / examples / msg / kademlia / answer.c
index 4eb095f..1475d1c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012. The SimGrid Team.
+/* Copyright (c) 2012-2013. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -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;
 }
 
 /**