gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16388 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r16388 - gnunet/src/transport
Date: Fri, 5 Aug 2011 11:36:02 +0200

Author: grothoff
Date: 2011-08-05 11:36:02 +0200 (Fri, 05 Aug 2011)
New Revision: 16388

Added:
   gnunet/src/transport/gnunet-service-transport_validation.c
Modified:
   gnunet/src/transport/Makefile.am
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_clients.c
   gnunet/src/transport/gnunet-service-transport_clients.h
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/gnunet-service-transport_neighbours.h
   gnunet/src/transport/gnunet-service-transport_validation.h
   gnunet/src/transport/transport.h
   gnunet/src/transport/transport_api_peer_address_lookup.c
Log:
more refactoring

Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am    2011-08-05 08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/Makefile.am    2011-08-05 09:36:02 UTC (rev 16388)
@@ -154,7 +154,7 @@
  gnunet-service-transport_hello.h gnunet-service-transport_hello.c \
  gnunet-service-transport_neighbours.h gnunet-service-transport_neighbours.c \
  gnunet-service-transport_plugins.h gnunet-service-transport_plugins.c \
- gnunet-service-transport_validation.h 
+ gnunet-service-transport_validation.h gnunet-service-transport_validation.c 
 gnunet_service_transport_new_LDADD = \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-08-05 08:39:20 UTC 
(rev 16387)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-08-05 09:36:02 UTC 
(rev 16388)
@@ -5963,7 +5963,6 @@
 
   uint16_t size;
   struct GNUNET_SERVER_TransmitContext *tc;
-  struct GNUNET_TIME_Absolute timeout;
   struct GNUNET_TIME_Relative rtimeout;
   char *addr_buf;
 
@@ -5976,8 +5975,7 @@
     }
   peer_address_lookup = (const struct PeerAddressLookupMessage *) message;
 
-  timeout = GNUNET_TIME_absolute_ntoh (peer_address_lookup->timeout);
-  rtimeout = GNUNET_TIME_absolute_get_remaining (timeout);
+  rtimeout = GNUNET_TIME_relative_ntoh (peer_address_lookup->timeout);
 
   neighbor_iterator = find_neighbour (&peer_address_lookup->peer);
 

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2011-08-05 
08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2011-08-05 
09:36:02 UTC (rev 16388)
@@ -28,6 +28,7 @@
 #include "gnunet-service-transport_hello.h"
 #include "gnunet-service-transport_neighbours.h"
 #include "gnunet-service-transport_plugins.h"
+#include "gnunet-service-transport_validation.h"
 #include "gnunet-service-transport.h"
 #include "transport.h"
 
@@ -427,6 +428,23 @@
 
 
 /**
+ * Client sent us a HELLO.  Process the request.
+ *
+ * @param cls unused
+ * @param client the client
+ * @param message the HELLO message
+ */
+void
+GST_clients_handle_hello (void *cls,
+                         struct GNUNET_SERVER_Client *client,
+                         const struct GNUNET_MessageHeader *message)
+{
+  GST_validation_handle_hello (message);
+  GNUNET_SERVER_receive_done (client, GNUNET_OK);
+}
+
+
+/**
  * Client asked for transmission to a peer.  Process the request.
  *
  * @param cls unused
@@ -438,6 +456,8 @@
                         struct GNUNET_SERVER_Client *client,
                         const struct GNUNET_MessageHeader *message)
 {
+  /* FIXME */
+  GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
 }
 
 
@@ -568,8 +588,52 @@
 
 
 /**
+ * Send an address to the client.
+ *
+ * @param cls our 'struct GNUNET_SERVER_TransmitContext' (for sending)
+ * @param target peer this change is about, never NULL
+ * @param last_validated_at is FOREVER if the address has not been validated 
(we're currently checking)
+ *                          is ZERO if the address was validated a long time 
ago (from PEERINFO)
+ *                          is a time in the past if this process validated 
the address
+ * @param validation_block  is FOREVER if the address is for an unsupported 
plugin (from PEERINFO)
+ *                          is ZERO if the address is considered valid (no 
validation needed)
+ *                          is a time in the future if we're currently denying 
re-validation
+ * @param plugin_name name of the plugin
+ * @param plugin_address binary address
+ * @param plugin_address_len length of address
+ */
+static void
+send_address_to_client (void *cls,
+                       const struct GNUNET_PeerIdentity *target,
+                       struct GNUNET_TIME_Absolute last_validated_at,
+                       struct GNUNET_TIME_Absolute validation_block,
+                       const char *plugin_name,
+                       const void *plugin_address,
+                       size_t plugin_address_len)
+{
+  struct GNUNET_SERVER_TransmitContext *tc = cls;
+  char *addr_buf;
+
+  /* FIXME: move to a binary format!!! */
+  GNUNET_asprintf (&addr_buf, "%s --- %s, %s",
+                  GST_plugins_a2s (plugin_name,
+                                   plugin_address,
+                                   plugin_address_len),
+                  (GNUNET_YES == GST_neighbours_test_connected (target))
+                  ? "CONNECTED"
+                  : "DISCONNECTED",
+                  (last_validated_at.abs_value < 
GNUNET_TIME_UNIT_FOREVER_ABS.abs_value)
+                  ? "VALIDATED"
+                  : "UNVALIDATED");
+  transmit_address_to_client (tc, addr_buf);
+  GNUNET_free (addr_buf);
+}
+
+
+/**
  * Client asked to obtain information about a peer's addresses.
  * Process the request.
+ * FIXME: use better name!
  *
  * @param cls unused
  * @param client the client
@@ -580,13 +644,55 @@
                                        struct GNUNET_SERVER_Client *client,
                                        const struct GNUNET_MessageHeader 
*message)
 {
+  const struct PeerAddressLookupMessage *peer_address_lookup;
+  struct GNUNET_SERVER_TransmitContext *tc;
+
+  peer_address_lookup = (const struct PeerAddressLookupMessage *) message;
+  GNUNET_break (ntohl (peer_address_lookup->reserved) == 0);
+  tc = GNUNET_SERVER_transmit_context_create (client);
+  (void) GST_validation_get_addresses (&peer_address_lookup->peer,
+                                      GNUNET_YES,
+                                      &send_address_to_client,
+                                      tc);
+  GNUNET_SERVER_transmit_context_append_data (tc,
+                                             NULL, 0,
+                                             
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY);
+  GNUNET_SERVER_transmit_context_run (tc, 
+                                     GNUNET_TIME_UNIT_FOREVER_REL);
 }
 
 
 /**
- * Client asked to obtain information about all addresses.
- * Process the request.
+ * Output the active address of connected neighbours to the given client.
  *
+ * @param cls the 'struct GNUNET_SERVER_TransmitContext' for transmission to 
the client
+ * @param neighbour identity of the neighbour
+ * @param ats performance data
+ * @param ats_count number of entries in ats (excluding 0-termination)
+ */
+static void
+output_addresses (void *cls,
+                 const struct GNUNET_PeerIdentity *neighbour,
+                 const struct GNUNET_TRANSPORT_ATS_Information *ats,
+                 uint32_t ats_count)
+{
+  struct GNUNET_SERVER_TransmitContext *tc = cls;
+  char *addr_buf;
+
+  /* FIXME: move to a binary format!!! */
+  GNUNET_asprintf (&addr_buf, 
+                  "%s: %s",
+                  GNUNET_i2s(neighbour),
+                  GST_plugins_a2s ("FIXME", NULL, 0));
+  transmit_address_to_client (tc, addr_buf);
+  GNUNET_free (addr_buf);
+}
+
+
+/**
+ * Client asked to obtain information about all actively used addresses.
+ * Process the request.  FIXME: use better name!
+ *
  * @param cls unused
  * @param client the client
  * @param message the peer address information request
@@ -595,7 +701,16 @@
 GST_clients_handle_address_iterate (void *cls,
                                    struct GNUNET_SERVER_Client *client,
                                    const struct GNUNET_MessageHeader *message)
-{
+{ 
+  struct GNUNET_SERVER_TransmitContext *tc;
+
+  GNUNET_SERVER_disable_receive_done_warning (client);
+  tc = GNUNET_SERVER_transmit_context_create (client);
+  GST_neighbours_iterate (&output_addresses,
+                         tc);
+  GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
+                                              
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY);
+  GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
 }
 
 

Modified: gnunet/src/transport/gnunet-service-transport_clients.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.h     2011-08-05 
08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/gnunet-service-transport_clients.h     2011-08-05 
09:36:02 UTC (rev 16388)
@@ -62,6 +62,19 @@
 
 
 /**
+ * Client sent us a HELLO.  Process the request.
+ *
+ * @param cls unused
+ * @param client the client
+ * @param message the HELLO message
+ */
+void
+GST_clients_handle_hello (void *cls,
+                         struct GNUNET_SERVER_Client *client,
+                         const struct GNUNET_MessageHeader *message);
+
+
+/**
  * Client asked for transmission to a peer.  Process the request.
  *
  * @param cls unused

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-08-05 
08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-08-05 
09:36:02 UTC (rev 16388)
@@ -174,6 +174,8 @@
  * @param sender_address address of the other peer, NULL if other peer
  *                       connected to us
  * @param sender_address_len number of bytes in sender_address
+ * @param ats performance data
+ * @param ats_count number of entries in ats (excluding 0-termination)
  * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
  */
 int
@@ -181,7 +183,9 @@
                            const struct GNUNET_MessageHeader *hdr,
                            const char *plugin_name,
                            const void *sender_address,
-                           size_t sender_address_len)
+                           size_t sender_address_len,
+                           const struct GNUNET_TRANSPORT_ATS_Information *ats,
+                           uint32_t ats_count)
 {
   return GNUNET_SYSERR;
 }
@@ -196,6 +200,8 @@
  * @param sender_address address of the other peer, NULL if other peer
  *                       connected to us
  * @param sender_address_len number of bytes in sender_address
+ * @param ats performance data
+ * @param ats_count number of entries in ats (excluding 0-termination)
  * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
  */
 int
@@ -203,7 +209,9 @@
                               const struct GNUNET_MessageHeader *hdr,
                               const char *plugin_name,
                               const void *sender_address,
-                              size_t sender_address_len)
+                              size_t sender_address_len,
+                              const struct GNUNET_TRANSPORT_ATS_Information 
*ats,
+                              uint32_t ats_count)
 {
   return GNUNET_SYSERR;
 }

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.h  2011-08-05 
08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.h  2011-08-05 
09:36:02 UTC (rev 16388)
@@ -152,6 +152,8 @@
  * @param sender_address address of the other peer, NULL if other peer
  *                       connected to us
  * @param sender_address_len number of bytes in sender_address
+ * @param ats performance data
+ * @param ats_count number of entries in ats (excluding 0-termination)
  * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
  */
 int
@@ -159,7 +161,9 @@
                            const struct GNUNET_MessageHeader *hdr,
                            const char *plugin_name,
                            const void *sender_address,
-                           size_t sender_address_len);
+                           size_t sender_address_len,
+                           const struct GNUNET_TRANSPORT_ATS_Information *ats,
+                           uint32_t ats_count);
 
 
 /**
@@ -171,6 +175,8 @@
  * @param sender_address address of the other peer, NULL if other peer
  *                       connected to us
  * @param sender_address_len number of bytes in sender_address
+ * @param ats performance data
+ * @param ats_count number of entries in ats (excluding 0-termination)
  * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
  */
 int
@@ -178,7 +184,9 @@
                               const struct GNUNET_MessageHeader *hdr,
                               const char *plugin_name,
                               const void *sender_address,
-                              size_t sender_address_len);
+                              size_t sender_address_len,
+                              const struct GNUNET_TRANSPORT_ATS_Information 
*ats,
+                              uint32_t ats_count);
 
 
 /**

Added: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c                  
        (rev 0)
+++ gnunet/src/transport/gnunet-service-transport_validation.c  2011-08-05 
09:36:02 UTC (rev 16388)
@@ -0,0 +1,143 @@
+/*
+     This file is part of GNUnet.
+     (C) 2010,2011 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file transport/gnunet-service-transport_validation.c
+ * @brief address validation subsystem
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet-service-transport_validation.h"
+
+
+/**
+ * Start the validation subsystem.
+ */
+void 
+GST_validation_start ()
+{
+}
+
+
+/**
+ * Stop the validation subsystem.
+ */
+void
+GST_validation_stop ()
+{
+}
+
+
+/**
+ * We've received a PING.  If appropriate, generate a PONG.
+ *
+ * @param sender peer sending the PING
+ * @param hdr the PING
+ * @param plugin_name name of plugin that received the PING
+ * @param sender_address address of the sender as known to the plugin, NULL
+ *                       if we did not initiate the connection
+ * @param sender_address_len number of bytes in sender_address
+ */
+void
+GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
+                           const struct GNUNET_MessageHeader *hdr,
+                           const char *plugin_name,
+                           const void *sender_address,
+                           size_t sender_address_len)
+{
+}
+
+
+/**
+ * We've received a PONG.  Check if it matches a pending PING and
+ * mark the respective address as confirmed.
+ *
+ * @param sender peer sending the PONG
+ * @param hdr the PONG
+ * @param plugin_name name of plugin that received the PONG
+ * @param sender_address address of the sender as known to the plugin, NULL
+ *                       if we did not initiate the connection
+ * @param sender_address_len number of bytes in sender_address
+ */
+void
+GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
+                           const struct GNUNET_MessageHeader *hdr,
+                           const char *plugin_name,
+                           const void *sender_address,
+                           size_t sender_address_len)
+{
+}
+
+
+/**
+ * We've received a HELLO, check which addresses are new and trigger
+ * validation.
+ *
+ * @param hello the HELLO we received
+ */
+void
+GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
+{
+}
+
+
+/**
+ * Opaque handle to stop incremental validation address callbacks.
+ */
+struct GST_ValidationIteratorContext
+{
+};
+
+
+/**
+ * Call the given function for each address for the given target.
+ * Can either give a snapshot (synchronous API) or be continuous.
+ *
+ * @param target peer information is requested for
+ * @param snapshot_only GNUNET_YES to iterate over addresses once, GNUNET_NO to
+ *                      continue to give information about addresses as it 
evolves
+ * @param cb function to call; will not be called after this function returns
+ *                             if snapshot_only is GNUNET_YES
+ * @param cb_cls closure for 'cb'
+ * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES
+ */
+struct GST_ValidationIteratorContext *
+GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
+                             int snapshot_only,
+                             GST_ValidationAddressCallback cb,
+                             void *cb_cls)
+{
+  return NULL;
+}
+
+
+/**
+ * Cancel an active validation address iteration.
+ *
+ * @param ctx the context of the operation that is cancelled
+ */
+void
+GST_validation_get_addresses_cancel (struct GST_ValidationIteratorContext *ctx)
+{
+  GNUNET_break (0);
+}
+
+
+/* end of file gnunet-service-transport_validation.c */

Modified: gnunet/src/transport/gnunet-service-transport_validation.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.h  2011-08-05 
08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/gnunet-service-transport_validation.h  2011-08-05 
09:36:02 UTC (rev 16388)
@@ -20,7 +20,7 @@
 
 /**
  * @file transport/gnunet-service-transport_validation.h
- * @brief plugin management API
+ * @brief address validation API
  * @author Christian Grothoff
  */
 #ifndef GNUNET_SERVICE_TRANSPORT_VALIDATION_H
@@ -31,33 +31,49 @@
 
 
 /**
- *
+ * Start the validation subsystem.
  */
 void 
 GST_validation_start (void);
 
 
 /**
- *
+ * Stop the validation subsystem.
  */
 void
 GST_validation_stop (void);
 
 
 /**
+ * We've received a PING.  If appropriate, generate a PONG.
  *
+ * @param sender peer sending the PING
+ * @param hdr the PING
+ * @param plugin_name name of plugin that received the PING
+ * @param sender_address address of the sender as known to the plugin, NULL
+ *                       if we did not initiate the connection
+ * @param sender_address_len number of bytes in sender_address
  */
-int
+void
 GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
                            const struct GNUNET_MessageHeader *hdr,
                            const char *plugin_name,
                            const void *sender_address,
                            size_t sender_address_len);
 
+
 /**
+ * We've received a PONG.  Check if it matches a pending PING and
+ * mark the respective address as confirmed.
  *
+ * @param sender peer sending the PONG
+ * @param hdr the PONG
+ * @param plugin_name name of plugin that received the PONG
+ * @param sender_address address of the sender as known to the plugin, NULL
+ *                       if we did not initiate the connection
+ * @param sender_address_len number of bytes in sender_address
  */
-int
+void
 GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
                            const struct GNUNET_MessageHeader *hdr,
                            const char *plugin_name,
@@ -66,21 +82,36 @@
 
 
 /**
+ * We've received a HELLO, check which addresses are new and trigger
+ * validation.
  *
+ * @param hello the HELLO we received
  */
 void
 GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello);
 
 
+/**
+ * Opaque handle to stop incremental validation address callbacks.
+ */
 struct GST_ValidationIteratorContext;
 
+
 /**
+ * Function called for each address (or address status change) that
+ * the validation module is aware of (for the given target).
+ *
+ * @param cls closure
+ * @param target peer this change is about, never NULL
  * @param last_validated_at is FOREVER if the address has not been validated 
(we're currently checking)
  *                          is ZERO if the address was validated a long time 
ago (from PEERINFO)
  *                          is a time in the past if this process validated 
the address
  * @param validation_block  is FOREVER if the address is for an unsupported 
plugin (from PEERINFO)
  *                          is ZERO if the address is considered valid (no 
validation needed)
  *                          is a time in the future if we're currently denying 
re-validation
+ * @param plugin_name name of the plugin
+ * @param plugin_address binary address
+ * @param plugin_address_len length of address
  */
 typedef void (*GST_ValidationAddressCallback)(void *cls,
                                              const struct GNUNET_PeerIdentity 
*target,
@@ -90,13 +121,31 @@
                                              const void *plugin_address,
                                              size_t plugin_address_len);
 
+
+/**
+ * Call the given function for each address for the given target.
+ * Can either give a snapshot (synchronous API) or be continuous.
+ *
+ * @param target peer information is requested for
+ * @param snapshot_only GNUNET_YES to iterate over addresses once, GNUNET_NO to
+ *                      continue to give information about addresses as it 
evolves
+ * @param cb function to call; will not be called after this function returns
+ *                             if snapshot_only is GNUNET_YES
+ * @param cb_cls closure for 'cb'
+ * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES
+ */
 struct GST_ValidationIteratorContext *
 GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
+                             int snapshot_only,
                              GST_ValidationAddressCallback cb,
                              void *cb_cls);
 
 
-
+/**
+ * Cancel an active validation address iteration.
+ *
+ * @param ctx the context of the operation that is cancelled
+ */
 void
 GST_validation_get_addresses_cancel (struct GST_ValidationIteratorContext 
*ctx);
 

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2011-08-05 08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/transport.h    2011-08-05 09:36:02 UTC (rev 16388)
@@ -322,6 +322,7 @@
      followed by the 0-terminated name of the transport */
 };
 
+
 /**
  * Message from the library to the transport service
  * asking for human readable addresses known for a peer.
@@ -334,16 +335,22 @@
   struct GNUNET_MessageHeader header;
 
   /**
-   * timeout to give up.
+   * For alignment.
    */
-  struct GNUNET_TIME_AbsoluteNBO timeout;
+  uint32_t reserved;
 
   /**
+   * timeout to give up.  FIXME: remove in the future.
+   */
+  struct GNUNET_TIME_RelativeNBO timeout;
+
+  /**
    * The identity of the peer to look up.
    */
   struct GNUNET_PeerIdentity peer;
 };
 
+
 /**
  * Message from the library to the transport service
  * asking for human readable addresses known for a peer.
@@ -356,11 +363,17 @@
   struct GNUNET_MessageHeader header;
 
   /**
-   * timeout to give up.
+   * For alignment.
    */
+  uint32_t reserved;
+
+  /**
+   * timeout to give up.  FIXME: remove in the future
+   */
   struct GNUNET_TIME_AbsoluteNBO timeout;
 };
 
+
 /**
  * Change in blacklisting (either request or notification,
  * depending on which direction it is going).

Modified: gnunet/src/transport/transport_api_peer_address_lookup.c
===================================================================
--- gnunet/src/transport/transport_api_peer_address_lookup.c    2011-08-05 
08:39:20 UTC (rev 16387)
+++ gnunet/src/transport/transport_api_peer_address_lookup.c    2011-08-05 
09:36:02 UTC (rev 16388)
@@ -134,7 +134,6 @@
                                       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;
 
@@ -144,16 +143,14 @@
       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,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]