[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33350 - in gnunet/src: ats ats-tests ats-tool dv fs includ
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33350 - in gnunet/src: ats ats-tests ats-tool dv fs include testbed |
Date: |
Wed, 21 May 2014 10:02:38 +0200 |
Author: wachs
Date: 2014-05-21 10:02:38 +0200 (Wed, 21 May 2014)
New Revision: 33350
Modified:
gnunet/src/ats-tests/ats-testing.c
gnunet/src/ats-tool/gnunet-ats.c
gnunet/src/ats/ats_api_performance.c
gnunet/src/ats/perf_ats_solver.c
gnunet/src/ats/test_ats_api_bandwidth_consumption.c
gnunet/src/ats/test_ats_api_performance_monitor.c
gnunet/src/ats/test_ats_api_performance_monitor_initial_callback.c
gnunet/src/ats/test_ats_solver_preferences.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/fs/gnunet-service-fs.c
gnunet/src/include/gnunet_ats_service.h
gnunet/src/include/gnunet_nat_lib.h
gnunet/src/testbed/gnunet-daemon-latency-logger.c
Log:
performance API indicates disconnect
Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c 2014-05-20 16:13:07 UTC (rev
33349)
+++ gnunet/src/ats/ats_api_performance.c 2014-05-21 08:02:38 UTC (rev
33350)
@@ -587,6 +587,7 @@
GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph,
GNUNET_TIME_UNIT_FOREVER_REL);
return;
+
reconnect:
if (NULL != ph->th)
{
@@ -595,7 +596,14 @@
}
GNUNET_CLIENT_disconnect (ph->client);
ph->client = NULL;
- /* FIXME: need to signal monitor that we were disconnected! */
+ if (NULL != ph->addr_info_cb)
+ {
+ /* Indicate reconnect */
+ ph->addr_info_cb (ph->addr_info_cb_cls, NULL, GNUNET_NO,
+ GNUNET_BANDWIDTH_value_init (0),
+ GNUNET_BANDWIDTH_value_init(0),
+ NULL, 0);
+ }
ph->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&reconnect_task, ph);
}
Modified: gnunet/src/ats/perf_ats_solver.c
===================================================================
--- gnunet/src/ats/perf_ats_solver.c 2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/ats/perf_ats_solver.c 2014-05-21 08:02:38 UTC (rev 33350)
@@ -27,7 +27,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet-service-ats_addresses.h"
-
+#include "gnunet-service-ats_normalization.h"
#include "gnunet_ats_service.h"
#include "gnunet_ats_plugin.h"
#include "test_ats_api_common.h"
Modified: gnunet/src/ats/test_ats_api_bandwidth_consumption.c
===================================================================
--- gnunet/src/ats/test_ats_api_bandwidth_consumption.c 2014-05-20 16:13:07 UTC
(rev 33349)
+++ gnunet/src/ats/test_ats_api_bandwidth_consumption.c 2014-05-21 08:02:38 UTC
(rev 33350)
@@ -192,7 +192,7 @@
p = GNUNET_new (struct PeerContext);
addr = GNUNET_new (struct Address);
- atp = GNUNET_ATS_performance_init (cfg, &performance_cb, NULL);
+ atp = GNUNET_ATS_performance_init (cfg, NULL, NULL);
if (atp == NULL)
{
ret = GNUNET_SYSERR;
Modified: gnunet/src/ats/test_ats_api_performance_monitor.c
===================================================================
--- gnunet/src/ats/test_ats_api_performance_monitor.c 2014-05-20 16:13:07 UTC
(rev 33349)
+++ gnunet/src/ats/test_ats_api_performance_monitor.c 2014-05-21 08:02:38 UTC
(rev 33350)
@@ -106,6 +106,10 @@
static int peer0 = GNUNET_NO;
static int peer1 = GNUNET_NO;
static int done = GNUNET_NO;
+
+ if (NULL == address)
+ return;
+
if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof
(p[0].id))))
{
peer0 = GNUNET_YES;
Modified: gnunet/src/ats/test_ats_api_performance_monitor_initial_callback.c
===================================================================
--- gnunet/src/ats/test_ats_api_performance_monitor_initial_callback.c
2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/ats/test_ats_api_performance_monitor_initial_callback.c
2014-05-21 08:02:38 UTC (rev 33350)
@@ -107,6 +107,9 @@
static int peer1 = GNUNET_NO;
static int done = GNUNET_NO;
+ if (NULL == address)
+ return;
+
if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
{
peer0 ++;
Modified: gnunet/src/ats/test_ats_solver_preferences.c
===================================================================
--- gnunet/src/ats/test_ats_solver_preferences.c 2014-05-20 16:13:07 UTC
(rev 33349)
+++ gnunet/src/ats/test_ats_solver_preferences.c 2014-05-21 08:02:38 UTC
(rev 33350)
@@ -145,6 +145,9 @@
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
{
+ if (NULL == address)
+ return;
+
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "ATS performance info: `%s'\n",
GNUNET_i2s (&address->peer));
}
Modified: gnunet/src/ats-tests/ats-testing.c
===================================================================
--- gnunet/src/ats-tests/ats-testing.c 2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/ats-tests/ats-testing.c 2014-05-21 08:02:38 UTC (rev 33350)
@@ -556,6 +556,8 @@
int log;
char *peer_id;
+
+
p = find_partner (me, &address->peer);
if (NULL == p)
{
Modified: gnunet/src/ats-tool/gnunet-ats.c
===================================================================
--- gnunet/src/ats-tool/gnunet-ats.c 2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/ats-tool/gnunet-ats.c 2014-05-21 08:02:38 UTC (rev 33350)
@@ -288,15 +288,34 @@
}
static void
-ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active,
+ats_perf_mon_cb(void *cls, const struct GNUNET_HELLO_Address *address, int
active,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
{
- struct PendingResolutions * pr;
+ struct PendingResolutions *pr;
+ struct PendingResolutions *cur;
+ struct PendingResolutions *next;
- if ((GNUNET_YES == op_monitor) && (GNUNET_NO == verbose))
+ if (NULL == address)
{
+ /* ATS service temporarily disconnected, remove current state */
+ next = head;
+ for (cur = next; NULL != cur; cur = next)
+ {
+ next = cur->next;
+ GNUNET_CONTAINER_DLL_remove (head, tail, cur);
+ GNUNET_TRANSPORT_address_to_string_cancel (cur->tats_ctx);
+ GNUNET_HELLO_address_free (cur->address);
+ GNUNET_free (cur);
+ }
+
+ GNUNET_CONTAINER_multipeermap_iterate(addresses, &free_addr_it, NULL);
+ return;
+ }
+
+ if (GNUNET_NO == verbose)
+ {
struct AddressFindCtx actx;
actx.src = address;
@@ -316,7 +335,6 @@
actx.res->bandwidth_out = bandwidth_out;
}
}
-
struct ATSAddress *a = GNUNET_new (struct ATSAddress);
a->address = GNUNET_HELLO_address_copy(address);
a->bandwidth_in = bandwidth_in;
@@ -325,27 +343,35 @@
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
- if (NULL != address)
- {
- pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
- ats_count * sizeof (struct GNUNET_ATS_Information));
+ pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
+ ats_count * sizeof (struct GNUNET_ATS_Information));
- pr->ats_count = ats_count;
- pr->ats = (struct GNUNET_ATS_Information *) &pr[1];
- if (ats_count > 0)
- memcpy (pr->ats, ats, ats_count * sizeof(struct GNUNET_ATS_Information));
- pr->address = GNUNET_HELLO_address_copy (address);
- pr->bandwidth_in = bandwidth_in;
- pr->bandwidth_out = bandwidth_out;
- pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
- resolve_addresses_numeric,
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
- transport_addr_to_str_cb, pr);
- GNUNET_CONTAINER_DLL_insert(head, tail, pr);
- results++;
- pending++;
- }
- else
+ pr->ats_count = ats_count;
+ pr->ats = (struct GNUNET_ATS_Information *) &pr[1];
+ if (ats_count > 0)
+ memcpy (pr->ats, ats, ats_count * sizeof(struct GNUNET_ATS_Information));
+ pr->address = GNUNET_HELLO_address_copy (address);
+ pr->bandwidth_in = bandwidth_in;
+ pr->bandwidth_out = bandwidth_out;
+ pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
+ resolve_addresses_numeric,
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
+ transport_addr_to_str_cb, pr);
+ GNUNET_CONTAINER_DLL_insert (head, tail, pr);
+ results++;
+ pending++;
+}
+
+
+static void
+ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+ const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
+{
+ struct PendingResolutions * pr;
+
+ if (NULL == address)
{
/* All messages received */
receive_done = GNUNET_YES;
@@ -358,6 +384,24 @@
end_task = GNUNET_SCHEDULER_add_now (end, NULL );
}
}
+
+ pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
+ ats_count * sizeof (struct GNUNET_ATS_Information));
+
+ pr->ats_count = ats_count;
+ pr->ats = (struct GNUNET_ATS_Information *) &pr[1];
+ if (ats_count > 0)
+ memcpy (pr->ats, ats, ats_count * sizeof(struct GNUNET_ATS_Information));
+ pr->address = GNUNET_HELLO_address_copy (address);
+ pr->bandwidth_in = bandwidth_in;
+ pr->bandwidth_out = bandwidth_out;
+ pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
+ resolve_addresses_numeric,
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
+ transport_addr_to_str_cb, pr);
+ GNUNET_CONTAINER_DLL_insert(head, tail, pr);
+ results++;
+ pending++;
}
static unsigned int
@@ -510,7 +554,7 @@
}
else if (op_monitor)
{
- ph = GNUNET_ATS_performance_init (cfg, &ats_perf_cb, NULL );
+ ph = GNUNET_ATS_performance_init (cfg, &ats_perf_mon_cb, NULL );
if (NULL == ph)
fprintf (stderr, _("Cannot connect to ATS service, exiting...\n") );
end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&end,
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/dv/gnunet-service-dv.c 2014-05-21 08:02:38 UTC (rev 33350)
@@ -1321,6 +1321,12 @@
uint32_t distance;
enum GNUNET_ATS_Network_Type network = GNUNET_ATS_NET_UNSPECIFIED;
+ if (NULL == address)
+ {
+ /* ATS service temporarily disconnected */
+ return;
+ }
+
if (GNUNET_NO == active)
return;
distance = get_atsi_distance (ats, ats_count);
Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c 2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/fs/gnunet-service-fs.c 2014-05-21 08:02:38 UTC (rev 33350)
@@ -254,6 +254,12 @@
unsigned int i;
struct GNUNET_TIME_Relative latency;
+ if (NULL == address)
+ {
+ /* ATS service temporarily disconnected */
+ return;
+ }
+
if (GNUNET_YES != active)
return;
for (i = 0; i < ats_count; i++)
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2014-05-20 16:13:07 UTC (rev
33349)
+++ gnunet/src/include/gnunet_ats_service.h 2014-05-21 08:02:38 UTC (rev
33350)
@@ -756,9 +756,9 @@
* Signature of a function that is called with QoS information about an
address.
*
* @param cls closure
- * @param address the address
+ * @param address the address, NULL if ATS service was disconnected
* @param address_active is this address actively used to maintain a connection
- * to a peer
+ to a peer
* @param bandwidth_out assigned outbound bandwidth for the connection
* @param bandwidth_in assigned inbound bandwidth for the connection
* @param ats performance data for the address (as far as known)
@@ -766,10 +766,12 @@
*/
typedef void
(*GNUNET_ATS_AddressInformationCallback) (void *cls,
- const struct GNUNET_HELLO_Address *address, int address_active,
+ const struct GNUNET_HELLO_Address *address,
+ int address_active,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
+ const struct GNUNET_ATS_Information *ats,
+ uint32_t ats_count);
/**
* Handle for an address listing operation
Modified: gnunet/src/include/gnunet_nat_lib.h
===================================================================
--- gnunet/src/include/gnunet_nat_lib.h 2014-05-20 16:13:07 UTC (rev 33349)
+++ gnunet/src/include/gnunet_nat_lib.h 2014-05-21 08:02:38 UTC (rev 33350)
@@ -297,7 +297,7 @@
*
* @param cls closure
* @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO
to mean
- * the previous (now invalid) one
+ * the previous (now invalid) one, #GNUNET_SYSERR indicates an error
* @param addr either the previous or the new public IP address
* @param addrlen actual length of the @a addr
* @param result GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific
error code
Modified: gnunet/src/testbed/gnunet-daemon-latency-logger.c
===================================================================
--- gnunet/src/testbed/gnunet-daemon-latency-logger.c 2014-05-20 16:13:07 UTC
(rev 33349)
+++ gnunet/src/testbed/gnunet-daemon-latency-logger.c 2014-05-21 08:02:38 UTC
(rev 33350)
@@ -190,6 +190,12 @@
int latency;
unsigned int cnt;
+ if (NULL == address)
+ {
+ /* ATS service temporarily disconnected */
+ return;
+ }
+
GNUNET_assert (NULL != db);
if (GNUNET_NO == address_active)
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33350 - in gnunet/src: ats ats-tests ats-tool dv fs include testbed,
gnunet <=