checks
authorChristian Grothoff <christian@grothoff.org>
Fri, 17 Jun 2011 20:28:00 +0000 (20:28 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 17 Jun 2011 20:28:00 +0000 (20:28 +0000)
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_pr.c

index 350ee54f1484b8ced13a3e7a5b33f305a019426e..56129273c6be661783728e019e97a23d6eb5ac18 100644 (file)
@@ -1189,6 +1189,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
   enum GNUNET_BLOCK_Type type;
   GNUNET_PEER_Id spid;
 
+  GNUNET_assert (other != NULL);
   msize = ntohs(message->size);
   if (msize < sizeof (struct GetMessage))
     {
@@ -1299,13 +1300,14 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
   spid = 0;
   if ( (GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) ||
        (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > 
-       GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value * 2 + GNUNET_LOAD_get_average (GSF_rt_entry_lifetime)) )
+       GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value * 2 + GNUNET_LOAD_get_average (GSF_rt_entry_lifetime)) ) 
     {
       /* don't have BW to send to peer, or would likely take longer than we have for it,
         so at best indirect the query */
       priority = 0;
       options |= GSF_PRO_FORWARD_ONLY;
       spid = GNUNET_PEER_intern (other);
+      GNUNET_assert (0 != spid);
     }
   ttl = bound_ttl (ntohl (gm->ttl), priority);
   /* decrement ttl (always) */
index e17d778db5571084e55abbfffc6c9e018fd150d0..c43b1be04b5a4552e7a7678bbc3f199a91fc042a 100644 (file)
@@ -328,6 +328,8 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
   pr->sender_pid = sender_pid;
   pr->rh = rh;
   pr->rh_cls = rh_cls;
+  GNUNET_assert ( (sender_pid != 0) ||
+                 (0 == (options & GSF_PRO_FORWARD_ONLY)) );
   if (ttl >= 0)
     pr->public_data.ttl = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
                                                                                           (uint32_t) ttl));
@@ -503,10 +505,10 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
   k = 0;
   bm = 0;
   do_route = (0 == (pr->public_data.options & GSF_PRO_FORWARD_ONLY));
-  if ( (do_route) && (pr->sender_pid == 0))
+  if ( (do_route) && (pr->sender_pid == 0))
     {
       GNUNET_break (0);
-      do_route = GNUNET_NO;
+      do_route = GNUNET_YES;
     }
   if (! do_route)
     {