stuff
[oweals/gnunet.git] / src / transport / transport_api_peer_address_lookup.c
index 6eb241078a4f6fdc4ac2ff71d4d44c4ba28219c5..c63856d4a4c317c2e1bc6c22e7855bec690fc9a8 100644 (file)
      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
 */
+
+/**
+ * @file transport/transport_api_peer_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
+ * the status of connections to a specific peer.  Calls back with a
+ * pretty printed string of the address, as formatted by the appropriate
+ * 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_arm_service.h"
@@ -122,7 +134,6 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle *
                                       void *peer_address_callback_cls)
 {
   struct PeerAddressLookupMessage msg;
-  struct GNUNET_TIME_Absolute abs_timeout;
   struct AddressLookupCtx *peer_address_lookup_cb;
   struct GNUNET_CLIENT_Connection *client;
 
@@ -132,16 +143,14 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle *
       peer_address_callback (peer_address_callback_cls, NULL);
       return;
     }
-  abs_timeout = GNUNET_TIME_relative_to_absolute (timeout);
-
   msg.header.size = htons (sizeof(struct PeerAddressLookupMessage));
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP);
-  msg.timeout = GNUNET_TIME_absolute_hton (abs_timeout);
+  msg.timeout = GNUNET_TIME_relative_hton (timeout);
   memcpy(&msg.peer, peer, sizeof(struct GNUNET_PeerIdentity));
   peer_address_lookup_cb = GNUNET_malloc (sizeof (struct AddressLookupCtx));
   peer_address_lookup_cb->cb = peer_address_callback;
   peer_address_lookup_cb->cb_cls = peer_address_callback_cls;
-  peer_address_lookup_cb->timeout = abs_timeout;
+  peer_address_lookup_cb->timeout = GNUNET_TIME_relative_to_absolute (timeout);
   peer_address_lookup_cb->client = client;
   GNUNET_assert (GNUNET_OK ==
                 GNUNET_CLIENT_transmit_and_get_response (client,