gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31535 - gnunet/src/dv


From: gnunet
Subject: [GNUnet-SVN] r31535 - gnunet/src/dv
Date: Wed, 18 Dec 2013 15:39:57 +0100

Author: grothoff
Date: 2013-12-18 15:39:57 +0100 (Wed, 18 Dec 2013)
New Revision: 31535

Modified:
   gnunet/src/dv/gnunet-service-dv.c
Log:
-fix distance calculations / ntohs vs ntohl

Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c   2013-12-18 14:29:56 UTC (rev 31534)
+++ gnunet/src/dv/gnunet-service-dv.c   2013-12-18 14:39:57 UTC (rev 31535)
@@ -444,8 +444,9 @@
   size_t size;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Delivering message from peer `%s'\n",
-              GNUNET_i2s (origin));
+              "Delivering message from peer `%s' at distance %u\n",
+              GNUNET_i2s (origin),
+              (unsigned int) distance);
   size = sizeof (struct GNUNET_DV_ReceivedMessage) +
     ntohs (message->size);
   if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
@@ -863,7 +864,7 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Adding peer `%s' with distance %u to SET\n",
                 GNUNET_i2s (&target->peer),
-                ntohl (target->distance));
+                ntohl (target->distance) + 1);
     GNUNET_SET_add_element (neighbor->my_set,
                             &element,
                             &build_set, neighbor);
@@ -1814,7 +1815,7 @@
     if ( (NULL == route) &&
          (NULL == GNUNET_CONTAINER_multipeermap_get (direct_neighbors,
                                                      &rm->sender)) &&
-         (ntohs (rm->distance) < DEFAULT_FISHEYE_DEPTH) )
+         (ntohl (rm->distance) < DEFAULT_FISHEYE_DEPTH) )
     {
       /* don't have reverse route yet, learn it! */
       neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors,
@@ -1830,7 +1831,7 @@
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Learning target %s at distance %u from delivery!\n",
                   GNUNET_i2s (&rm->sender),
-                  1 + ntohs (rm->distance));
+                  1 + ntohl (rm->distance));
       if (NULL == neighbor->neighbor_table)
         neighbor->neighbor_table = GNUNET_CONTAINER_multipeermap_create (10, 
GNUNET_NO);
       if (GNUNET_YES !=
@@ -1849,7 +1850,7 @@
                ntohs (payload->size));
     send_data_to_plugin (payload,
                         &rm->sender,
-                        ntohl (route->target.distance));
+                        1 + ntohl (rm->distance));
     return GNUNET_OK;
   }
   if ( (NULL == GNUNET_CONTAINER_multipeermap_get (direct_neighbors,
@@ -1860,7 +1861,7 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Learning target %s at distance %u from forwarding!\n",
                 GNUNET_i2s (&rm->sender),
-                1 + ntohs (rm->distance));
+                1 + ntohl (rm->distance));
     neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors,
                                                   peer);
     if (NULL == neighbor)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]