use long long
[oweals/gnunet.git] / src / dht / gnunet-service-dht_clients.c
index 5ae25ea4deb072d777061345a4c2a521873ed171..1a4e71314a8f21a8593a895ac01487443a06787a 100644 (file)
@@ -332,7 +332,7 @@ transmit_request (struct ClientQueryRecord *cqr)
 
   /* exponential back-off for retries, max 1h */
   cqr->retry_frequency = 
-    GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_HOURS,
+    GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS,
                              GNUNET_TIME_relative_multiply (cqr->retry_frequency, 2));
   cqr->retry_time = GNUNET_TIME_relative_to_absolute (cqr->retry_frequency);
 }
@@ -370,6 +370,8 @@ transmit_next_request_task (void *cls,
          return;
        }
       transmit_request (cqr);
+      cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr,
+                                                cqr->retry_time.abs_value);
     }
 }
 
@@ -765,6 +767,9 @@ forward_reply (void *cls, const GNUNET_HashCode * key, void *value)
                 _("Unsupported block type (%u) in request!\n"),
                 record->type);
     return GNUNET_NO;
+  default:
+    GNUNET_break (0);
+    return GNUNET_NO;
   }
   if (GNUNET_NO == frc->do_copy)
     {
@@ -853,10 +858,10 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
   reply->expiration = GNUNET_TIME_absolute_hton (expiration);
   reply->key = *key;
   paths = (struct GNUNET_PeerIdentity*) &reply[1];
-  memcpy (paths, get_path, 
-         sizeof (struct GNUNET_PeerIdentity) * get_path_length);
-  memcpy (&paths[get_path_length], 
-         put_path, sizeof (struct GNUNET_PeerIdentity) * put_path_length);
+  memcpy (paths, put_path, 
+         sizeof (struct GNUNET_PeerIdentity) * put_path_length);
+  memcpy (&paths[put_path_length], 
+         get_path, sizeof (struct GNUNET_PeerIdentity) * get_path_length);
   memcpy (&paths[get_path_length + put_path_length],
          data, 
          data_size);
@@ -871,6 +876,9 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
   if (GNUNET_NO == frc.do_copy)
     {
       /* did not match any of the requests, free! */
+      GNUNET_STATISTICS_update (GDS_stats,
+                               gettext_noop ("# REPLIES ignored for CLIENTS (no match)"), 1,
+                               GNUNET_NO);
       GNUNET_free (pm);
     }
 }