[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26741 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26741 - gnunet/src/transport |
Date: |
Wed, 3 Apr 2013 17:18:26 +0200 |
Author: wachs
Date: 2013-04-03 17:18:26 +0200 (Wed, 03 Apr 2013)
New Revision: 26741
Modified:
gnunet/src/transport/gnunet-service-transport_manipulation.c
Log:
changes
Modified: gnunet/src/transport/gnunet-service-transport_manipulation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_manipulation.c
2013-04-03 14:59:01 UTC (rev 26740)
+++ gnunet/src/transport/gnunet-service-transport_manipulation.c
2013-04-03 15:18:26 UTC (rev 26741)
@@ -360,11 +360,11 @@
ats = (struct GNUNET_ATS_Information *) &tm[1];
for (c = 0; c < ntohs (tm->ats_count); c++)
{
+ set_metric (&man_handle.general,
direction, ats[c].type, ats[c].value);
+
type = htonl (ats[c].type);
value = htonl (ats[c].value);
- set_metric (&man_handle.general,
direction, type, value);
-
switch (type) {
case
GNUNET_ATS_QUALITY_NET_DELAY:
if ((TM_RECEIVE ==
direction) || (TM_BOTH == direction))
@@ -409,7 +409,7 @@
type = htonl (ats[c].type);
value = htonl (ats[c].value);
- set_metric (tmp, direction, type, value);
+ set_metric (tmp, direction, ats[c].type, ats[c].value);
switch (type) {
@@ -473,10 +473,10 @@
{
/* Manipulate here */
/* Delay */
- if (UINT32_MAX != tmp->metrics[TM_SEND][DELAY])
+ if (UINT32_MAX != ntohl (find_metric(tmp, htonl
(GNUNET_ATS_QUALITY_NET_DELAY), TM_SEND)))
{
/* We have a delay */
- delay.rel_value =
tmp->metrics[TM_SEND][DELAY];
+ delay.rel_value = ntohl
(find_metric(tmp, htonl (GNUNET_ATS_QUALITY_NET_DELAY), TM_SEND));
dqe = GNUNET_malloc (sizeof (struct
DelayQueueEntry) + msg_size);
dqe->tmp = tmp;
dqe->sent_at = GNUNET_TIME_absolute_add
(GNUNET_TIME_absolute_get(), delay);
@@ -492,10 +492,10 @@
return;
}
}
- else if (man_handle.delay_send.rel_value != 0)
+ else if (UINT32_MAX != ntohl (find_metric (&man_handle.general, htonl
(GNUNET_ATS_QUALITY_NET_DELAY), TM_SEND)))
{
/* We have a delay */
- delay = man_handle.delay_send;
+ delay.rel_value = ntohl (find_metric
(&man_handle.general, htonl (GNUNET_ATS_QUALITY_NET_DELAY), TM_SEND));
dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) +
msg_size);
dqe->tmp = tmp;
dqe->sent_at = GNUNET_TIME_absolute_add
(GNUNET_TIME_absolute_get(), delay);
@@ -618,33 +618,40 @@
void
GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg)
{
+ unsigned long long tmp;
+
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
- "transport", "MANIPULATE_DISTANCE_IN",
&man_handle.distance_recv))
+ "transport", "MANIPULATE_DISTANCE_IN", &tmp))
+ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting inbound
distance_in to %u\n",
- (unsigned long long) man_handle.distance_recv);
- else
- man_handle.distance_recv = 0;
+ (unsigned long long) tmp);
+ set_metric (&man_handle.general, TM_RECEIVE, htonl
(GNUNET_ATS_QUALITY_NET_DISTANCE), htonl(tmp));
+ }
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
- "transport", "MANIPULATE_DISTANCE_OUT",
&man_handle.distance_send))
+ "transport", "MANIPULATE_DISTANCE_OUT", &tmp))
+ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting outbound
distance_in to %u\n",
- (unsigned long long) man_handle.distance_send);
- else
- man_handle.distance_send = 0;
+ (unsigned long long) tmp);
+ set_metric (&man_handle.general, TM_SEND, htonl
(GNUNET_ATS_QUALITY_NET_DISTANCE), htonl(tmp));
+ }
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg,
- "transport", "MANIPULATE_DELAY_IN",
&man_handle.delay_recv))
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
+ "transport", "MANIPULATE_DELAY_IN", &tmp))
+ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Delaying inbound traffic
for %llu ms\n",
- (unsigned long long)
man_handle.delay_recv.rel_value);
- else
- man_handle.delay_recv.rel_value = 0;
+ (unsigned long long) tmp);
+ set_metric (&man_handle.general, TM_RECEIVE, htonl
(GNUNET_ATS_QUALITY_NET_DELAY), htonl(tmp));
+ }
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg,
- "transport", "MANIPULATE_DELAY_OUT",
&man_handle.delay_send))
+
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
+ "transport", "MANIPULATE_DELAY_OUT", &tmp))
+ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Delaying outbound traffic
for %llu ms\n",
- (unsigned long long) man_handle.delay_send.rel_value);
- else
- man_handle.delay_send.rel_value = 0;
+ (unsigned long long) tmp);
+ set_metric (&man_handle.general, TM_SEND, htonl
(GNUNET_ATS_QUALITY_NET_DELAY), htonl(tmp));
+ }
man_handle.peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26741 - gnunet/src/transport,
gnunet <=