summaryrefslogtreecommitdiff
path: root/src/transport/transport_api_address_to_string.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-11-29 18:04:01 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-11-29 18:04:01 +0000
commit56c32ea37a52b239494a7f91933e60eb7caf30f3 (patch)
tree5c8c8ef6b577da4931ec3e546b2fb60ed0e8f029 /src/transport/transport_api_address_to_string.c
parent5ca85864950a1fe92613f5ed3a69cd08d248423e (diff)
- finale commit for the api change
Diffstat (limited to 'src/transport/transport_api_address_to_string.c')
-rw-r--r--src/transport/transport_api_address_to_string.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c
index 2e5a34ce2..87ee9ad83 100644
--- a/src/transport/transport_api_address_to_string.c
+++ b/src/transport/transport_api_address_to_string.c
@@ -76,7 +76,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg)
return;
}
GNUNET_break (ntohs (msg->type) ==
- GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
size = ntohs (msg->size);
if (size == sizeof (struct GNUNET_MessageHeader))
{
@@ -131,8 +131,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
char *addrbuf;
GNUNET_assert (address != NULL);
- alen = GNUNET_HELLO_address_get_size (address);
- len = sizeof (struct AddressLookupMessage) + alen;
+ len = sizeof (struct AddressLookupMessage) + GNUNET_HELLO_address_get_size (address);
if (len >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
@@ -144,6 +143,8 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
return NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"GNUNET_TRANSPORT_address_to_string\n");
+
+ alen = address->address_length;
msg = GNUNET_malloc (len);
msg->header.size = htons (len);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING);
@@ -151,7 +152,9 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
msg->timeout = GNUNET_TIME_relative_hton (timeout);
msg->addrlen = htonl (alen);
addrbuf = (char *) &msg[1];
- memcpy (addrbuf, address, alen);
+ memcpy (addrbuf, address->address, alen);
+ strcpy (&addrbuf[alen], address->transport_name);
+
alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressToStringContext));
alc->cb = aluc;
alc->cb_cls = aluc_cls;
@@ -183,4 +186,4 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct
-/* end of transport_api_address_lookup.c */
+/* end of transport_api_address_to_string.c */