-fixes
[oweals/gnunet.git] / src / fs / gnunet-service-fs_cp.c
index 164e264c619bb85c6d763fc46cfa135061d05b8b..e84993bd38b07c402da69e3866c339e3ea2dd2f9 100644 (file)
@@ -875,6 +875,7 @@ get_randomized_delay ()
  * @param pr handle to the original pending request
  * @param reply_anonymity_level anonymity level for the reply, UINT32_MAX for "unknown"
  * @param expiration when does 'data' expire?
+ * @param last_transmission when did we last transmit a request for this block
  * @param type type of the block
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
@@ -883,6 +884,7 @@ static void
 handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
                   struct GSF_PendingRequest *pr, uint32_t reply_anonymity_level,
                   struct GNUNET_TIME_Absolute expiration,
+                  struct GNUNET_TIME_Absolute last_transmission,
                   enum GNUNET_BLOCK_Type type, const void *data,
                   size_t data_len)
 {
@@ -910,11 +912,9 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
                                 1, GNUNET_NO);
     return;
   }
-#if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Transmitting result for query `%s' to peer\n",
               GNUNET_h2s (&prd->query));
-#endif
   GNUNET_STATISTICS_update (GSF_stats,
                             gettext_noop ("# replies received for other peers"),
                             1, GNUNET_NO);
@@ -1192,7 +1192,6 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
     cp = cps;
   if (cp == NULL)
   {
-#if DEBUG_FS
     if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO))
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Failed to find RETURN-TO peer `%4s' in connection set. Dropping query.\n",
@@ -1203,7 +1202,6 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Failed to find peer `%4s' in connection set. Dropping query.\n",
                   GNUNET_i2s (other));
-#endif
     GNUNET_STATISTICS_update (GSF_stats,
                               gettext_noop
                               ("# requests dropped due to missing reverse route"),
@@ -1216,19 +1214,15 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
   priority = bound_priority (ntohl (gm->priority), cps);
   if (priority < 0)
   {
-#if DEBUG_FS
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Dropping query from `%s', this peer is too busy.\n",
                 GNUNET_i2s (other));
-#endif
     return NULL;
   }
-#if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received request for `%s' of type %u from peer `%4s' with flags %u\n",
               GNUNET_h2s (&gm->query), (unsigned int) type, GNUNET_i2s (other),
               (unsigned int) bm);
-#endif
   namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL;
   if ((type == GNUNET_BLOCK_TYPE_FS_SBLOCK) && (namespace == NULL))
   {
@@ -1265,11 +1259,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
                                                     TTL_DECREMENT);
   if ((ttl < 0) && (((int32_t) (ttl - ttl_decrement)) > 0))
   {
-#if DEBUG_FS
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Dropping query from `%s' due to TTL underflow (%d - %u).\n",
                 GNUNET_i2s (other), ttl, ttl_decrement);
-#endif
     GNUNET_STATISTICS_update (GSF_stats,
                               gettext_noop
                               ("# requests dropped due TTL underflow"), 1,
@@ -1293,11 +1285,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
       {
         /* existing request has higher TTL, drop new one! */
         prd->priority += priority;
-#if DEBUG_FS
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                     "Have existing request with higher TTL, dropping new request.\n",
                     GNUNET_i2s (other));
-#endif
         GNUNET_STATISTICS_update (GSF_stats,
                                   gettext_noop
                                   ("# requests dropped due to higher-TTL request"),
@@ -1350,10 +1340,8 @@ peer_transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct GSF_PeerTransmitHandle *pth = cls;
   struct GSF_ConnectedPeer *cp;
 
-#if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Timeout trying to transmit to other peer\n");
-#endif
   pth->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   cp = pth->cp;
   GNUNET_CONTAINER_DLL_remove (cp->pth_head, cp->pth_tail, pth);
@@ -1715,19 +1703,15 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
 {
   if (cp->last_migration_block.abs_value > block_time.abs_value)
   {
-#if DEBUG_FS
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Migration already blocked for another %llu ms\n",
                 (unsigned long long)
                 GNUNET_TIME_absolute_get_remaining
                 (cp->last_migration_block).rel_value);
-#endif
     return;                     /* already blocked */
   }
-#if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n",
               (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value);
-#endif
   cp->last_migration_block = block_time;
   if (cp->migration_pth != NULL)
     GSF_peer_transmit_cancel_ (cp->migration_pth);
@@ -1816,7 +1800,9 @@ cron_flush_trust (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     return;
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
     return;
-  GNUNET_SCHEDULER_add_delayed (TRUST_FLUSH_FREQ, &cron_flush_trust, NULL);
+  GNUNET_SCHEDULER_add_delayed_with_priority (TRUST_FLUSH_FREQ,
+                                             GNUNET_SCHEDULER_PRIORITY_HIGH,
+                                             &cron_flush_trust, NULL);
 }