[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15861 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15861 - gnunet/src/transport |
Date: |
Wed, 6 Jul 2011 17:48:30 +0200 |
Author: wachs
Date: 2011-07-06 17:48:30 +0200 (Wed, 06 Jul 2011)
New Revision: 15861
Modified:
gnunet/src/transport/Makefile.am
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/transport.h
Log:
ats related changes
Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am 2011-07-06 15:47:43 UTC (rev 15860)
+++ gnunet/src/transport/Makefile.am 2011-07-06 15:48:30 UTC (rev 15861)
@@ -234,6 +234,7 @@
check_PROGRAMS = \
test_transport_ats \
+ test_transport_ats_multiple_peers \
$(TRANSPORT_BENCHMARKS) \
test_transport_api_tcp \
test_transport_api_tcp_nat \
@@ -266,6 +267,7 @@
if ENABLE_TEST_RUN
TESTS = \
test_transport_ats \
+ test_transport_ats_multiple_peers \
perf_transport_ats \
test_transport_api_tcp \
test_transport_api_tcp_nat \
@@ -297,11 +299,20 @@
endif
test_transport_ats_SOURCES = \
- test_transport_ats.c
+ test_transport_ats.c transport_ats.c
test_transport_ats_LDADD = -lm \
$(top_builddir)/src/transport/libgnunettransportnew.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(GN_GLPK)
+
+test_transport_ats_multiple_peers_SOURCES = \
+ test_transport_ats_multiple_peers.c
+test_transport_ats_multiple_peers_LDADD = -lm \
+ $(top_builddir)/src/transport/libgnunettransportnew.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_transport_ats_SOURCES = \
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2011-07-06 15:47:43 UTC
(rev 15860)
+++ gnunet/src/transport/gnunet-service-transport.c 2011-07-06 15:48:30 UTC
(rev 15861)
@@ -927,7 +927,7 @@
/**
* Handle for ats information
*/
-static struct ATS_info *ats;
+static struct ATS_Handle *ats;
/**
* The peer specified by the given neighbour has timed-out or a plugin
@@ -973,33 +973,34 @@
static int update_addr_value (struct ForeignAddressList *fal, uint32_t value ,
int ats_index)
{
- int c;
- int set = GNUNET_NO;
- for (c=0; c<available_quality_metrics; c++)
- {
- if (ats_index == qm[c].atis_index)
- {
- fal->quality[c].values[0] = fal->quality[c].values[1];
- fal->quality[c].values[1] = fal->quality[c].values[2];
- fal->quality[c].values[2] = value;
- set = GNUNET_YES;
- ats->stat.modified_quality = GNUNET_YES;
- }
- }
- if (set == GNUNET_NO)
- {
- for (c=0; c<available_ressources; c++)
- {
- if (ats_index == ressources[c].atis_index)
- {
- fal->ressources[c].c = value;
- set = GNUNET_YES;
- ats->stat.modified_resources = GNUNET_YES;
- }
- }
- }
-
- return set;
+ int c;
+ int set = GNUNET_NO;
+ for (c=0; c<available_quality_metrics; c++)
+ {
+ if (ats_index == qm[c].atis_index)
+ {
+ fal->quality[c].values[0] = fal->quality[c].values[1];
+ fal->quality[c].values[1] = fal->quality[c].values[2];
+ fal->quality[c].values[2] = value;
+ set = GNUNET_YES;
+ if (ats != NULL)
+ ats->stat.modified_quality = GNUNET_YES;
+ }
+ }
+ if (set == GNUNET_NO)
+ {
+ for (c=0; c<available_ressources; c++)
+ {
+ if (ats_index == ressources[c].atis_index)
+ {
+ fal->ressources[c].c = value;
+ set = GNUNET_YES;
+ if (ats != NULL)
+ ats->stat.modified_resources = GNUNET_YES;
+ }
+ }
+ }
+ return set;
}
static int
@@ -2436,7 +2437,8 @@
return;
}
GNUNET_free (pos);
- ats->stat.recreate_problem = GNUNET_YES;
+ if (ats != NULL)
+ ats->stat.recreate_problem = GNUNET_YES;
if (nl->received_pong == GNUNET_NO)
{
GNUNET_STATISTICS_update (stats,
@@ -2598,7 +2600,7 @@
/* notify ats about connecting peer */
/* notify ats about connecting peer */
- if (shutdown_in_progress == GNUNET_NO)
+ if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO))
{
ats->stat.recreate_problem = GNUNET_YES;
ats_calculate_bandwidth_distribution (ats, stats, neighbours);
@@ -2647,7 +2649,7 @@
memcpy (&dim.peer, peer, sizeof (struct GNUNET_PeerIdentity));
/* notify ats about connecting peer */
- if (shutdown_in_progress == GNUNET_NO)
+ if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO))
{
ats->stat.recreate_problem = GNUNET_YES;
ats_calculate_bandwidth_distribution (ats, stats, neighbours);
@@ -4843,7 +4845,8 @@
GNUNET_free(peer_pos->quality);
peer_pos->ressources = NULL;
GNUNET_free(peer_pos);
- ats->stat.recreate_problem = GNUNET_YES;
+ if (ats != NULL)
+ ats->stat.recreate_problem = GNUNET_YES;
}
GNUNET_free (rpos);
}
@@ -5316,19 +5319,19 @@
uint32_t value = ntohl(*((uint32_t *) &message[1]));
//GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"GNUNET_MESSAGE_TYPE_TRANSPORT_ATS: %i \n", value);
/* Force ressource and quality update */
- if (value == 4)
+ if ((value == 4) && (ats != NULL))
{
ats->stat.modified_resources = GNUNET_YES;
ats->stat.modified_quality = GNUNET_YES;
}
/* Force cost update */
- if (value == 3)
+ if ((value == 3) && (ats != NULL))
ats->stat.modified_resources = GNUNET_YES;
/* Force quality update */
- if (value == 2)
+ if ((value == 2) && (ats != NULL))
ats->stat.modified_quality = GNUNET_YES;
/* Force full rebuild */
- if (value == 1)
+ if ((value == 1) && (ats != NULL))
ats->stat.recreate_problem = GNUNET_YES;
}
@@ -6002,7 +6005,8 @@
GNUNET_CONTAINER_multihashmap_destroy (validation_map);
validation_map = NULL;
- ats_shutdown (ats);
+ if (ats != NULL)
+ ats_shutdown (ats);
/* free 'chvc' data structure */
while (NULL != (chvc = chvc_head))
@@ -6050,7 +6054,7 @@
schedule_ats (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct ATS_info *ats = (struct ATS_info *) cls;
+ struct ATS_Handle *ats = (struct ATS_Handle *) cls;
if (ats==NULL)
return;
@@ -6204,9 +6208,10 @@
refresh_hello ();
ats = ats_init (cfg);
- GNUNET_assert (ats != NULL);
- ats->ats_task = GNUNET_SCHEDULER_add_now (&schedule_ats, ats);
+ if (ats != NULL)
+ ats->ats_task = GNUNET_SCHEDULER_add_now (&schedule_ats, ats);
+
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Transport service ready.\n"));
Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h 2011-07-06 15:47:43 UTC (rev 15860)
+++ gnunet/src/transport/transport.h 2011-07-06 15:48:30 UTC (rev 15861)
@@ -30,12 +30,6 @@
#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
-/* Minimum time between to calculations*/
-#define ATS_MIN_INTERVAL
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 15)
-#define ATS_EXEC_INTERVAL
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
-#define ATS_MAX_EXEC_DURATION
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
-#define ATS_MAX_ITERATIONS INT_MAX
-
#define DEBUG_TRANSPORT 3
#define DEBUG_TRANSPORT_TIMEOUT GNUNET_NO
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15861 - gnunet/src/transport,
gnunet <=