[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26671 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26671 - gnunet/src/transport |
Date: |
Sat, 30 Mar 2013 12:59:50 +0100 |
Author: grothoff
Date: 2013-03-30 12:59:49 +0100 (Sat, 30 Mar 2013)
New Revision: 26671
Modified:
gnunet/src/transport/plugin_transport_http.c
gnunet/src/transport/plugin_transport_http_client.c
gnunet/src/transport/plugin_transport_http_server.c
gnunet/src/transport/plugin_transport_tcp.c
gnunet/src/transport/plugin_transport_udp.c
gnunet/src/transport/plugin_transport_udp_broadcasting.c
gnunet/src/transport/plugin_transport_unix.c
gnunet/src/transport/plugin_transport_wlan.c
Log:
-no longer pass distance information from non-DV plugins
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2013-03-30 11:28:18 UTC
(rev 26670)
+++ gnunet/src/transport/plugin_transport_http.c 2013-03-30 11:59:49 UTC
(rev 26671)
@@ -188,20 +188,18 @@
struct Session *s = cls;
struct Plugin *plugin = s->plugin;
struct GNUNET_TIME_Relative delay;
- struct GNUNET_ATS_Information atsi[2];
+ struct GNUNET_ATS_Information atsi;
- atsi[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- atsi[0].value = htonl (1);
- atsi[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- atsi[1].value = session->ats_address_network_type;
+ atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ atsi.value = session->ats_address_network_type;
GNUNET_break (session->ats_address_network_type != ntohl
(GNUNET_ATS_NET_UNSPECIFIED));
reschedule_session_timeout (session);
delay =
plugin->env->receive (plugin->env->cls, &s->target, message,
- (const struct GNUNET_ATS_Information *) &atsi,
- 2, s, s->addr, s->addrlen);
+ &atsi,
+ 1, s, s->addr, s->addrlen);
return delay;
}
Modified: gnunet/src/transport/plugin_transport_http_client.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_client.c 2013-03-30 11:28:18 UTC
(rev 26670)
+++ gnunet/src/transport/plugin_transport_http_client.c 2013-03-30 11:59:49 UTC
(rev 26671)
@@ -903,7 +903,7 @@
struct Session *s = cls;
struct HTTP_Client_Plugin *plugin;
struct GNUNET_TIME_Relative delay;
- struct GNUNET_ATS_Information atsi[2];
+ struct GNUNET_ATS_Information atsi;
char *stat_txt;
if (GNUNET_YES != client_exist_session(p, s))
{
@@ -912,21 +912,19 @@
}
plugin = s->plugin;
- atsi[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- atsi[0].value = htonl (1);
- atsi[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- atsi[1].value = s->ats_address_network_type;
+ atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ atsi.value = s->ats_address_network_type;
GNUNET_break (s->ats_address_network_type != ntohl
(GNUNET_ATS_NET_UNSPECIFIED));
delay = s->plugin->env->receive (plugin->env->cls, &s->target, message,
s, s->addr, s->addrlen);
plugin->env->update_address_metrics (plugin->env->cls,
- &s->target,
- s->addr,
- s->addrlen,
- s,
- (struct GNUNET_ATS_Information *) &atsi, 2);
+ &s->target,
+ s->addr,
+ s->addrlen,
+ s,
+ &atsi, 1);
GNUNET_asprintf (&stat_txt, "# bytes received via %s_client",
plugin->protocol);
GNUNET_STATISTICS_update (plugin->env->stats,
Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2013-03-30 11:28:18 UTC
(rev 26670)
+++ gnunet/src/transport/plugin_transport_http_server.c 2013-03-30 11:59:49 UTC
(rev 26671)
@@ -1269,7 +1269,8 @@
const struct GNUNET_MessageHeader *message)
{
struct Session *s = cls;
- struct GNUNET_ATS_Information atsi[2];
+ struct HTTP_Server_Plugin *plugin = s->plugin;
+ struct GNUNET_ATS_Information atsi;
struct GNUNET_TIME_Relative delay;
char *stat_txt;
@@ -1277,12 +1278,9 @@
if (GNUNET_NO == server_exist_session(p, s))
return GNUNET_OK;
- struct HTTP_Server_Plugin *plugin = s->plugin;
- atsi[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- atsi[0].value = htonl (1);
- atsi[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- atsi[1].value = s->ats_address_network_type;
+ atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ atsi.value = s->ats_address_network_type;
GNUNET_break (s->ats_address_network_type != ntohl
(GNUNET_ATS_NET_UNSPECIFIED));
@@ -1292,11 +1290,11 @@
s, s->addr, s->addrlen);
plugin->env->update_address_metrics (plugin->env->cls,
- &s->target,
- s->addr,
- s->addrlen,
- s,
- (struct GNUNET_ATS_Information *) &atsi, 2);
+ &s->target,
+ s->addr,
+ s->addrlen,
+ s,
+ &atsi, 1);
GNUNET_asprintf (&stat_txt, "# bytes received via %s_server",
plugin->protocol);
GNUNET_STATISTICS_update (plugin->env->stats,
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2013-03-30 11:28:18 UTC (rev
26670)
+++ gnunet/src/transport/plugin_transport_tcp.c 2013-03-30 11:59:49 UTC (rev
26671)
@@ -2035,12 +2035,10 @@
GNUNET_STATISTICS_update (plugin->env->stats,
gettext_noop ("# bytes received via TCP"),
ntohs (message->size), GNUNET_NO);
- struct GNUNET_ATS_Information distance[2];
+ struct GNUNET_ATS_Information distance;
- distance[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- distance[0].value = htonl (1);
- distance[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- distance[1].value = session->ats_address_network_type;
+ distance.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ distance.value = session->ats_address_network_type;
GNUNET_break (ntohl(session->ats_address_network_type) !=
GNUNET_ATS_NET_UNSPECIFIED);
GNUNET_assert (GNUNET_CONTAINER_multihashmap_contains_value
(plugin->sessionmap,
@@ -2056,10 +2054,10 @@
plugin->env->update_address_metrics (plugin->env->cls,
&session->target,
(GNUNET_YES == session->inbound) ? NULL : session->addr,
- (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
- session,
- (struct GNUNET_ATS_Information *) &distance,
- 2);
+ (GNUNET_YES == session->inbound) ? 0 :
session->addrlen,
+ session,
+ &distance,
+ 1);
reschedule_session_timeout (session);
Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2013-03-30 11:28:18 UTC (rev
26670)
+++ gnunet/src/transport/plugin_transport_udp.c 2013-03-30 11:59:49 UTC (rev
26671)
@@ -1893,17 +1893,13 @@
{
struct Plugin *plugin = cls;
struct SourceInformation *si = client;
- struct GNUNET_ATS_Information ats[2];
struct GNUNET_TIME_Relative delay;
GNUNET_assert (si->session != NULL);
if (GNUNET_YES == si->session->in_destroy)
return GNUNET_OK;
/* setup ATS */
- ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- ats[0].value = htonl (1);
- ats[1] = si->session->ats;
- GNUNET_break (ntohl(ats[1].value) != GNUNET_ATS_NET_UNSPECIFIED);
+ GNUNET_break (ntohl(si->session->ats.value) != GNUNET_ATS_NET_UNSPECIFIED);
delay = plugin->env->receive (plugin->env->cls,
&si->sender,
hdr,
@@ -1912,11 +1908,11 @@
si->args);
plugin->env->update_address_metrics (plugin->env->cls,
- &si->sender,
- si->arg,
- si->args,
- si->session,
- (struct GNUNET_ATS_Information *) &ats, 2);
+ &si->sender,
+ si->arg,
+ si->args,
+ si->session,
+ &si->session->ats, 1);
si->session->flow_delay_for_other_peer = delay;
reschedule_session_timeout(si->session);
Modified: gnunet/src/transport/plugin_transport_udp_broadcasting.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp_broadcasting.c 2013-03-30
11:28:18 UTC (rev 26670)
+++ gnunet/src/transport/plugin_transport_udp_broadcasting.c 2013-03-30
11:59:49 UTC (rev 26671)
@@ -89,7 +89,6 @@
};
-
int
broadcast_ipv6_mst_cb (void *cls, void *client,
const struct GNUNET_MessageHeader *message)
@@ -98,9 +97,10 @@
struct Plugin *plugin = cls;
struct Mstv6Context *mc = client;
const struct GNUNET_MessageHeader *hello;
- struct UDP_Beacon_Message *msg;
+ const struct UDP_Beacon_Message *msg;
+ struct GNUNET_ATS_Information atsi;
- msg = (struct UDP_Beacon_Message *) message;
+ msg = (const struct UDP_Beacon_Message *) message;
if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON !=
ntohs (msg->header.type))
@@ -109,28 +109,25 @@
"Received beacon with %u bytes from peer `%s' via address `%s'\n",
ntohs (msg->header.size), GNUNET_i2s (&msg->sender),
udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr)));
- struct GNUNET_ATS_Information atsi[2];
/* setup ATS */
- atsi[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- atsi[0].value = htonl (1);
- atsi[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- atsi[1].value = mc->ats_address_network_type;
+ atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ atsi.value = mc->ats_address_network_type;
GNUNET_break (ntohl(mc->ats_address_network_type) !=
GNUNET_ATS_NET_UNSPECIFIED);
hello = (struct GNUNET_MessageHeader *) &msg[1];
plugin->env->receive (plugin->env->cls,
-
&msg->sender,
-
hello,
+ &msg->sender,
+ hello,
NULL,
(const char *) &mc->addr,
sizeof (mc->addr));
plugin->env->update_address_metrics (plugin->env->cls,
- &msg->sender,
- (const char *) &mc->addr,
- sizeof (mc->addr),
- NULL,
- (struct GNUNET_ATS_Information *) &atsi, 2);
+ &msg->sender,
+ (const char *) &mc->addr,
+ sizeof (mc->addr),
+ NULL,
+ &atsi, 1);
GNUNET_STATISTICS_update (plugin->env->stats,
_
@@ -140,6 +137,7 @@
return GNUNET_OK;
}
+
int
broadcast_ipv4_mst_cb (void *cls, void *client,
const struct GNUNET_MessageHeader *message)
Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c 2013-03-30 11:28:18 UTC
(rev 26670)
+++ gnunet/src/transport/plugin_transport_unix.c 2013-03-30 11:59:49 UTC
(rev 26671)
@@ -796,13 +796,9 @@
const struct GNUNET_MessageHeader *currhdr,
const struct sockaddr_un *un, size_t fromlen)
{
- struct GNUNET_ATS_Information ats[2];
struct Session *s = NULL;
struct GNUNET_HELLO_Address * addr;
- ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- ats[0].value = htonl (UNIX_DIRECT_DISTANCE);
- ats[1] = plugin->ats_network;
GNUNET_break (ntohl(plugin->ats_network.value) !=
GNUNET_ATS_NET_UNSPECIFIED);
GNUNET_assert (fromlen >= sizeof (struct sockaddr_un));
@@ -826,11 +822,11 @@
s, un->sun_path, strlen (un->sun_path) + 1);
plugin->env->update_address_metrics (plugin->env->cls,
- sender,
- un->sun_path,
- strlen (un->sun_path) + 1,
- s,
- (struct GNUNET_ATS_Information *) &ats, 2);
+ sender,
+ un->sun_path,
+ strlen (un->sun_path) + 1,
+ s,
+ &plugin->ats_network, 1);
GNUNET_free (addr);
}
Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c 2013-03-30 11:28:18 UTC
(rev 26670)
+++ gnunet/src/transport/plugin_transport_wlan.c 2013-03-30 11:59:49 UTC
(rev 26671)
@@ -1132,18 +1132,15 @@
struct Plugin *plugin = cls;
struct MacAndSession *mas = client;
struct MacAndSession xmas;
-#define NUM_ATS 2
- struct GNUNET_ATS_Information ats[NUM_ATS]; /* FIXME: do better here */
+ struct GNUNET_ATS_Information ats;
struct FragmentMessage *fm;
struct GNUNET_PeerIdentity tmpsource;
const struct WlanHeader *wlanheader;
int ret;
uint16_t msize;
- ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- ats[0].value = htonl (1);
- ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- ats[1].value = htonl (GNUNET_ATS_NET_WLAN);
+ ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ ats.value = htonl (GNUNET_ATS_NET_WLAN);
msize = ntohs (hdr->size);
GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1176,11 +1173,11 @@
(mas->endpoint == NULL) ? NULL : (const char *)
&mas->endpoint->addr,
(mas->endpoint == NULL) ? 0 : sizeof (struct
GNUNET_TRANSPORT_WLAN_MacAddress));
plugin->env->update_address_metrics (plugin->env->cls,
- &tmpsource,
- (mas->endpoint == NULL) ? NULL : (const char *)
&mas->endpoint->addr,
- (mas->endpoint == NULL) ? 0 : sizeof (struct
GNUNET_TRANSPORT_WLAN_MacAddress),
- mas->session,
- (struct GNUNET_ATS_Information *) &ats, NUM_ATS);
+ &tmpsource,
+ (mas->endpoint == NULL) ? NULL :
(const char *) &mas->endpoint->addr,
+ (mas->endpoint == NULL) ? 0 : sizeof
(struct GNUNET_TRANSPORT_WLAN_MacAddress),
+ mas->session,
+ &ats, 1);
break;
case GNUNET_MESSAGE_TYPE_FRAGMENT:
if (NULL == mas->endpoint)
@@ -1299,16 +1296,15 @@
(mas->endpoint == NULL) ? NULL : (const char *)
&mas->endpoint->addr,
(mas->endpoint == NULL) ? 0 : sizeof (struct
GNUNET_TRANSPORT_WLAN_MacAddress));
plugin->env->update_address_metrics (plugin->env->cls,
- &mas->session->target,
- (mas->endpoint == NULL) ? NULL : (const char *)
&mas->endpoint->addr,
- (mas->endpoint == NULL) ? 0 : sizeof (struct
GNUNET_TRANSPORT_WLAN_MacAddress),
- mas->session,
- (struct GNUNET_ATS_Information *) &ats, NUM_ATS);
+ &mas->session->target,
+ (mas->endpoint == NULL) ? NULL :
(const char *) &mas->endpoint->addr,
+ (mas->endpoint == NULL) ? 0 : sizeof
(struct GNUNET_TRANSPORT_WLAN_MacAddress),
+ mas->session,
+ &ats, 1);
break;
}
return GNUNET_OK;
}
-#undef NUM_ATS
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26671 - gnunet/src/transport,
gnunet <=