Add missing include
[oweals/gnunet.git] / src / transport / transport_api_address_lookup.c
index 32bb41d553f4d0e9f84e5425f007e53e96f7675c..515be9bf8efb1447592e7d02607dba189cee84a3 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file transport/transport_api_peer_address_lookup.c
+ * @file transport/transport_api_address_lookup.c
  * @brief given a peer id, get all known addresses from transport service
  *
  * This api provides the ability to query the transport service about
  * transport plugin, and whether or not the address given is currently
  * in the 'connected' state (according to the transport service).
  */
-
 #include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_arm_service.h"
 #include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
 #include "gnunet_transport_service.h"
 #include "transport.h"
 
@@ -73,7 +70,7 @@ struct GNUNET_TRANSPORT_PeerIterateContext
    * Backoff for reconnect.
    */
   struct GNUNET_TIME_Relative backoff;
-  
+
   /**
    * Task ID for reconnect.
    */
@@ -119,7 +116,7 @@ send_request (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx)
   msg.timeout = GNUNET_TIME_absolute_hton (pal_ctx->timeout);
   msg.peer = pal_ctx->peer;
   GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client, 
+                 GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client,
                                                          &msg.header,
                                                           GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout),
                                                          GNUNET_YES,
@@ -129,7 +126,7 @@ send_request (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx)
 
 /**
  * Task run to re-establish the connection.
- * 
+ *
  * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*'
  * @param tc scheduler context, unused
  */
@@ -155,11 +152,9 @@ static void
 reconnect (struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx)
 {
   GNUNET_assert (GNUNET_NO == pal_ctx->one_shot);
-  GNUNET_CLIENT_disconnect (pal_ctx->client, GNUNET_NO);
+  GNUNET_CLIENT_disconnect (pal_ctx->client);
   pal_ctx->client = NULL;
-  pal_ctx->backoff = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS,
-                                              GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (pal_ctx->backoff, 2),
-                                                                        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)));
+  pal_ctx->backoff = GNUNET_TIME_STD_BACKOFF (pal_ctx->backoff);
   pal_ctx->reconnect_task = GNUNET_SCHEDULER_add_delayed (pal_ctx->backoff,
                                                          &do_connect,
                                                          pal_ctx);
@@ -294,17 +289,17 @@ peer_address_response_processor (void *cls,
 
 /**
  * Return all the known addresses for a specific peer or all peers.
- * Returns continously all address if one_shot is set to GNUNET_NO
+ * Returns continuously all address if one_shot is set to GNUNET_NO
  *
  * CHANGE: Returns the address(es) that we are currently using for this
  * peer.  Upon completion, the 'AddressLookUpCallback' is called one more
  * time with 'NULL' for the address and the peer.  After this, the operation must no
- * longer be explicitly cancelled.
+ * longer be explicitly canceled.
  *
  * @param cfg configuration to use
  * @param peer peer identity to look up the addresses of, CHANGE: allow NULL for all (connected) peers
  * @param one_shot GNUNET_YES to return the current state and then end (with NULL+NULL),
- *                 GNUNET_NO to monitor the set of addresses used (continuously, must be explicitly cancelled)
+ *                 GNUNET_NO to monitor the set of addresses used (continuously, must be explicitly canceled)
  * @param timeout how long is the lookup allowed to take at most (irrelevant if one_shot is set to GNUNET_NO)
  * @param peer_address_callback function to call with the results
  * @param peer_address_callback_cls closure for peer_address_callback
@@ -334,7 +329,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct
   pal_ctx->timeout = GNUNET_TIME_relative_to_absolute (timeout);
   if (NULL != peer)
     pal_ctx->peer = *peer;
-  pal_ctx->one_shot = one_shot;  
+  pal_ctx->one_shot = one_shot;
   pal_ctx->client = client;
   send_request (pal_ctx);
 
@@ -354,7 +349,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
 {
   if (NULL != alc->client)
   {
-    GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
+    GNUNET_CLIENT_disconnect (alc->client);
     alc->client = NULL;
   }
   if (GNUNET_SCHEDULER_NO_TASK != alc->reconnect_task)