Fixed reconnect
[oweals/gnunet.git] / src / fs / gnunet-service-fs_cp.c
index 1e93a475eb682622d5a301f7800435891c540dfb..69fb75be6f3f76e92767e63e9270df16d16ad5a6 100644 (file)
@@ -335,7 +335,13 @@ get_latency (const struct GNUNET_TRANSPORT_ATS_Information *atsi)
     atsi++;
   if (ntohl (atsi->type) == GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR)
   {
-    GNUNET_break (0);
+    static int once;
+
+    if (!once)
+    {
+      once = 1;
+      GNUNET_break (0);
+    }
     /* how can we not have latency data? */
     return GNUNET_TIME_UNIT_SECONDS;
   }
@@ -364,7 +370,7 @@ update_atsi (struct GSF_ConnectedPeer *cp,
 
 /**
  * Return the performance data record for the given peer
- * 
+ *
  * @param cp peer to query
  * @return performance data record for the peer
  */
@@ -383,7 +389,8 @@ GSF_get_peer_performance_data_ (struct GSF_ConnectedPeer *cp)
  * @param buf where to copy the message
  * @return number of bytes copied to buf
  */
-static size_t peer_transmit_ready_cb (void *cls, size_t size, void *buf);
+static size_t
+peer_transmit_ready_cb (void *cls, size_t size, void *buf);
 
 
 
@@ -400,12 +407,11 @@ static size_t peer_transmit_ready_cb (void *cls, size_t size, void *buf);
  *        long should the client wait until re-trying?
  * @param preference current traffic preference for the given peer
  */
-static void core_reserve_callback (void *cls,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   struct GNUNET_BANDWIDTH_Value32NBO
-                                   bandwidth_out, int32_t amount,
-                                   struct GNUNET_TIME_Relative res_delay,
-                                   uint64_t preference);
+static void
+core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
+                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+                       int32_t amount, struct GNUNET_TIME_Relative res_delay,
+                       uint64_t preference);
 
 
 /**
@@ -491,9 +497,8 @@ peer_transmit_ready_cb (void *cls, size_t size, void *buf)
     GNUNET_assert (0 < cp->ppd.pending_replies--);
   }
   GNUNET_LOAD_update (cp->ppd.transmission_delay,
-                      GNUNET_TIME_absolute_get_duration (pth->
-                                                         transmission_request_start_time).
-                      rel_value);
+                      GNUNET_TIME_absolute_get_duration
+                      (pth->transmission_request_start_time).rel_value);
   ret = pth->gmc (pth->gmc_cls, size, buf);
   GNUNET_assert (NULL == pth->cth);
   for (pos = cp->pth_head; pos != NULL; pos = pos->next)
@@ -819,7 +824,7 @@ transmit_delayed_now (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 /**
  * Get the randomized delay a response should be subjected to.
- * 
+ *
  * @return desired delay
  */
 static struct GNUNET_TIME_Relative
@@ -845,7 +850,7 @@ get_randomized_delay ()
  * Handle a reply to a pending request.  Also called if a request
  * expires (then with data == NULL).  The handler may be called
  * many times (depending on the request type), but will not be
- * called during or after a call to GSF_pending_request_cancel 
+ * called during or after a call to GSF_pending_request_cancel
  * and will also not be called anymore after a call signalling
  * expiration.
  *
@@ -998,7 +1003,7 @@ change_host_trust (struct GSF_ConnectedPeer *cp, int value)
 /**
  * We've received a request with the specified priority.  Bound it
  * according to how much we trust the given peer.
- * 
+ *
  * @param prio_in requested priority
  * @param cp the peer making the request
  * @return effective priority
@@ -1334,7 +1339,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
  * Function called if there has been a timeout trying to satisfy
  * a transmission request.
  *
- * @param cls the 'struct GSF_PeerTransmitHandle' of the request 
+ * @param cls the 'struct GSF_PeerTransmitHandle' of the request
  * @param tc scheduler context
  */
 static void
@@ -1718,7 +1723,7 @@ create_migration_stop_message (void *cls, size_t size, void *buf)
 /**
  * Ask a peer to stop migrating data to us until the given point
  * in time.
- * 
+ *
  * @param cp peer to ask
  * @param block_time until when to block
  */
@@ -1732,9 +1737,9 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
 #if DEBUG_FS && 0
     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);
+                (unsigned long long)
+                GNUNET_TIME_absolute_get_remaining
+                (cp->last_migration_block).rel_value);
 #endif
     return;                     /* already blocked */
   }