[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23475 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23475 - gnunet/src/transport |
Date: |
Tue, 28 Aug 2012 16:51:06 +0200 |
Author: wachs
Date: 2012-08-28 16:51:06 +0200 (Tue, 28 Aug 2012)
New Revision: 23475
Modified:
gnunet/src/transport/plugin_transport_http_client.c
Log:
changes
Modified: gnunet/src/transport/plugin_transport_http_client.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_client.c 2012-08-28 13:47:11 UTC
(rev 23474)
+++ gnunet/src/transport/plugin_transport_http_client.c 2012-08-28 14:51:06 UTC
(rev 23475)
@@ -935,7 +935,12 @@
GNUNET_i2s (&s->target));
return GNUNET_SYSERR;
}
+ else
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
+ "address peer `%s'\n",
+ http_common_plugin_address_to_string (plugin, s->addr,
s->addrlen));
+
GNUNET_asprintf (&url, "%s/%s;%u",
http_common_plugin_address_to_string (plugin, s->addr, s->addrlen),
GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),
@@ -1061,6 +1066,10 @@
{
struct HTTP_Client_Plugin *plugin = cls;
struct Session * s = NULL;
+ struct sockaddr *sa;
+ struct GNUNET_ATS_Information ats;
+ size_t salen = 0;
+ int res;
GNUNET_assert (plugin != NULL);
GNUNET_assert (address != NULL);
@@ -1082,14 +1091,48 @@
return NULL;
}
+ ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ ats.value = htonl (GNUNET_ATS_NET_UNSPECIFIED);
+ sa = http_common_socket_from_address (address->address,
address->address_length, &res);
+
+
+
+ if (GNUNET_SYSERR == res)
+ {
+ return NULL;
+ }
+ else if (GNUNET_YES == res)
+ {
+ GNUNET_assert (NULL != sa);
+ if (AF_INET == sa->sa_family)
+ {
+ salen = sizeof (struct sockaddr_in);
+ }
+ else if (AF_INET == sa->sa_family)
+ {
+ salen = sizeof (struct sockaddr_in6);
+ }
+ ats = plugin->env->get_address_type (plugin->env->cls, sa, salen);
+ GNUNET_free (sa);
+ }
+ else if (GNUNET_NO == res)
+ {
+ ats.value = htonl (GNUNET_ATS_COST_WAN);
+ }
+
+ if (GNUNET_ATS_NET_UNSPECIFIED == ntohl(ats.value))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+
s = GNUNET_malloc (sizeof (struct Session));
memcpy (&s->target, &address->peer, sizeof (struct GNUNET_PeerIdentity));
s->plugin = plugin;
s->addr = GNUNET_malloc (address->address_length);
memcpy (s->addr, address->address, address->address_length);
s->addrlen = address->address_length;
- //s->ats_address_network_type = ats.value;
- GNUNET_break (0);
+ s->ats_address_network_type = ats.value;
client_start_session_timeout (s);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23475 - gnunet/src/transport,
gnunet <=