summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-05 09:36:02 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-05 09:36:02 +0000
commitfb567582ca24ac7450336782365e86a177d8a472 (patch)
tree053b29071811155a328bf8dec1f1c922997fe02f
parentec057166095a225d45be16e66671e0f7f74cbef2 (diff)
more refactoring
-rw-r--r--src/transport/Makefile.am2
-rw-r--r--src/transport/gnunet-service-transport.c4
-rw-r--r--src/transport/gnunet-service-transport_clients.c121
-rw-r--r--src/transport/gnunet-service-transport_clients.h13
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c12
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h12
-rw-r--r--src/transport/gnunet-service-transport_validation.c143
-rw-r--r--src/transport/gnunet-service-transport_validation.h61
-rw-r--r--src/transport/transport.h19
-rw-r--r--src/transport/transport_api_peer_address_lookup.c7
10 files changed, 369 insertions, 25 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 395823724..63edcb15a 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -154,7 +154,7 @@ gnunet_service_transport_new_SOURCES = \
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 \
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 6fd17e72d..ea7ce98db 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -5963,7 +5963,6 @@ handle_peer_address_lookup (void *cls,
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 @@ handle_peer_address_lookup (void *cls,
}
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);
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 1ef28ad90..3b42c7a79 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -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 @@ GST_clients_handle_start (void *cls,
/**
+ * 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 @@ GST_clients_handle_send (void *cls,
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+ /* FIXME */
+ GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
}
@@ -568,8 +588,52 @@ GST_clients_handle_address_lookup (void *cls,
/**
+ * 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,12 +644,54 @@ GST_clients_handle_peer_address_lookup (void *cls,
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
@@ -595,7 +701,16 @@ void
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);
}
diff --git a/src/transport/gnunet-service-transport_clients.h b/src/transport/gnunet-service-transport_clients.h
index c18c051fb..a8ae14a53 100644
--- a/src/transport/gnunet-service-transport_clients.h
+++ b/src/transport/gnunet-service-transport_clients.h
@@ -62,6 +62,19 @@ GST_clients_handle_start (void *cls,
/**
+ * 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
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 4c25be39c..f961ea4f2 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -174,6 +174,8 @@ GST_neighbours_iterate (GST_NeighbourIterator cb,
* @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 @@ GST_neighbours_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)
+ size_t sender_address_len,
+ const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t ats_count)
{
return GNUNET_SYSERR;
}
@@ -196,6 +200,8 @@ GST_neighbours_handle_pong (const struct GNUNET_PeerIdentity *sender,
* @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 @@ GST_neighbours_handle_connect (const struct GNUNET_PeerIdentity *sender,
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;
}
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index 26b3a11b8..9c64f79ec 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -152,6 +152,8 @@ GST_neighbours_iterate (GST_NeighbourIterator cb,
* @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 @@ GST_neighbours_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);
+ size_t sender_address_len,
+ const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t ats_count);
/**
@@ -171,6 +175,8 @@ GST_neighbours_handle_pong (const struct GNUNET_PeerIdentity *sender,
* @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 @@ GST_neighbours_handle_connect (const struct GNUNET_PeerIdentity *sender,
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);
/**
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
new file mode 100644
index 000000000..6cdd99e25
--- /dev/null
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -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 */
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h
index 9768c425e..0d6e0ef5a 100644
--- a/src/transport/gnunet-service-transport_validation.h
+++ b/src/transport/gnunet-service-transport_validation.h
@@ -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 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
/**
+ * 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 @@ typedef void (*GST_ValidationAddressCallback)(void *cls,
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);
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 5384e7395..4d1d370d9 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -322,6 +322,7 @@ struct AddressLookupMessage
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,9 +335,14 @@ struct PeerAddressLookupMessage
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.
@@ -344,6 +350,7 @@ struct PeerAddressLookupMessage
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 AddressIterateMessage
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).
diff --git a/src/transport/transport_api_peer_address_lookup.c b/src/transport/transport_api_peer_address_lookup.c
index 2da4b6c69..c63856d4a 100644
--- a/src/transport/transport_api_peer_address_lookup.c
+++ b/src/transport/transport_api_peer_address_lookup.c
@@ -134,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;
@@ -144,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,