aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-21 08:02:38 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-21 08:02:38 +0000
commitcb8d8079b402d69f1fa92ccdb5242e117493e174 (patch)
treea9786560574bf0fd9e6cec9b0448dff14868f01b /src/ats
parent3a33753786eca144a1dd2c3c4884b78774f29e3b (diff)
downloadgnunet-cb8d8079b402d69f1fa92ccdb5242e117493e174.tar.gz
gnunet-cb8d8079b402d69f1fa92ccdb5242e117493e174.zip
performance API indicates disconnect
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/ats_api_performance.c10
-rw-r--r--src/ats/perf_ats_solver.c2
-rw-r--r--src/ats/test_ats_api_bandwidth_consumption.c2
-rw-r--r--src/ats/test_ats_api_performance_monitor.c4
-rw-r--r--src/ats/test_ats_api_performance_monitor_initial_callback.c3
-rw-r--r--src/ats/test_ats_solver_preferences.c3
6 files changed, 21 insertions, 3 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index a1d8dc21a..35dcc558f 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -587,6 +587,7 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
587 GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph, 587 GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph,
588 GNUNET_TIME_UNIT_FOREVER_REL); 588 GNUNET_TIME_UNIT_FOREVER_REL);
589 return; 589 return;
590
590 reconnect: 591 reconnect:
591 if (NULL != ph->th) 592 if (NULL != ph->th)
592 { 593 {
@@ -595,7 +596,14 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
595 } 596 }
596 GNUNET_CLIENT_disconnect (ph->client); 597 GNUNET_CLIENT_disconnect (ph->client);
597 ph->client = NULL; 598 ph->client = NULL;
598 /* FIXME: need to signal monitor that we were disconnected! */ 599 if (NULL != ph->addr_info_cb)
600 {
601 /* Indicate reconnect */
602 ph->addr_info_cb (ph->addr_info_cb_cls, NULL, GNUNET_NO,
603 GNUNET_BANDWIDTH_value_init (0),
604 GNUNET_BANDWIDTH_value_init(0),
605 NULL, 0);
606 }
599 ph->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 607 ph->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
600 &reconnect_task, ph); 608 &reconnect_task, ph);
601} 609}
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c
index a5307028d..4e1e68c23 100644
--- a/src/ats/perf_ats_solver.c
+++ b/src/ats/perf_ats_solver.c
@@ -27,7 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_statistics_service.h" 28#include "gnunet_statistics_service.h"
29#include "gnunet-service-ats_addresses.h" 29#include "gnunet-service-ats_addresses.h"
30 30#include "gnunet-service-ats_normalization.h"
31#include "gnunet_ats_service.h" 31#include "gnunet_ats_service.h"
32#include "gnunet_ats_plugin.h" 32#include "gnunet_ats_plugin.h"
33#include "test_ats_api_common.h" 33#include "test_ats_api_common.h"
diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c
index 493323657..b05a7cf22 100644
--- a/src/ats/test_ats_api_bandwidth_consumption.c
+++ b/src/ats/test_ats_api_bandwidth_consumption.c
@@ -192,7 +192,7 @@ run (void *cls,
192 p = GNUNET_new (struct PeerContext); 192 p = GNUNET_new (struct PeerContext);
193 addr = GNUNET_new (struct Address); 193 addr = GNUNET_new (struct Address);
194 194
195 atp = GNUNET_ATS_performance_init (cfg, &performance_cb, NULL); 195 atp = GNUNET_ATS_performance_init (cfg, NULL, NULL);
196 if (atp == NULL) 196 if (atp == NULL)
197 { 197 {
198 ret = GNUNET_SYSERR; 198 ret = GNUNET_SYSERR;
diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c
index 6ccac45d1..4b6b08b74 100644
--- a/src/ats/test_ats_api_performance_monitor.c
+++ b/src/ats/test_ats_api_performance_monitor.c
@@ -106,6 +106,10 @@ ats_perf_cb (void *cls,
106 static int peer0 = GNUNET_NO; 106 static int peer0 = GNUNET_NO;
107 static int peer1 = GNUNET_NO; 107 static int peer1 = GNUNET_NO;
108 static int done = GNUNET_NO; 108 static int done = GNUNET_NO;
109
110 if (NULL == address)
111 return;
112
109 if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof (p[0].id)))) 113 if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof (p[0].id))))
110 { 114 {
111 peer0 = GNUNET_YES; 115 peer0 = GNUNET_YES;
diff --git a/src/ats/test_ats_api_performance_monitor_initial_callback.c b/src/ats/test_ats_api_performance_monitor_initial_callback.c
index 6d305d3a5..377686673 100644
--- a/src/ats/test_ats_api_performance_monitor_initial_callback.c
+++ b/src/ats/test_ats_api_performance_monitor_initial_callback.c
@@ -107,6 +107,9 @@ ats_perf_cb (void *cls,
107 static int peer1 = GNUNET_NO; 107 static int peer1 = GNUNET_NO;
108 static int done = GNUNET_NO; 108 static int done = GNUNET_NO;
109 109
110 if (NULL == address)
111 return;
112
110 if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) 113 if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
111 { 114 {
112 peer0 ++; 115 peer0 ++;
diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c
index 117af470b..4de3d9a5b 100644
--- a/src/ats/test_ats_solver_preferences.c
+++ b/src/ats/test_ats_solver_preferences.c
@@ -145,6 +145,9 @@ perf_info_cb (void *cls,
145 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 145 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
146 const struct GNUNET_ATS_Information *ats, uint32_t ats_count) 146 const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
147{ 147{
148 if (NULL == address)
149 return;
150
148 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "ATS performance info: `%s'\n", 151 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "ATS performance info: `%s'\n",
149 GNUNET_i2s (&address->peer)); 152 GNUNET_i2s (&address->peer));
150} 153}