aboutsummaryrefslogtreecommitdiff
path: root/src/topology
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-26 00:23:59 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-26 00:24:13 +0200
commit2bdcb4fa971e582b516286c983469234bedeabde (patch)
treea18a971bb9c2d151440a6b8b1090b28117743451 /src/topology
parent82077f4b212f9b08141dc218537b3fad27b179f8 (diff)
downloadgnunet-2bdcb4fa971e582b516286c983469234bedeabde.tar.gz
gnunet-2bdcb4fa971e582b516286c983469234bedeabde.zip
fix build
Diffstat (limited to 'src/topology')
-rw-r--r--src/topology/Makefile.am1
-rw-r--r--src/topology/test_gnunet_daemon_topology.c32
2 files changed, 17 insertions, 16 deletions
diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am
index 97e4652d0..ae69ee8bc 100644
--- a/src/topology/Makefile.am
+++ b/src/topology/Makefile.am
@@ -56,6 +56,7 @@ test_gnunet_daemon_topology_SOURCES = \
56 test_gnunet_daemon_topology.c 56 test_gnunet_daemon_topology.c
57test_gnunet_daemon_topology_LDADD = \ 57test_gnunet_daemon_topology_LDADD = \
58 $(top_builddir)/src/testbed/libgnunettestbed.la \ 58 $(top_builddir)/src/testbed/libgnunettestbed.la \
59 $(top_builddir)/src/statistics/libgnunetstatistics.la \
59 $(top_builddir)/src/util/libgnunetutil.la 60 $(top_builddir)/src/util/libgnunetutil.la
60 61
61EXTRA_DIST = \ 62EXTRA_DIST = \
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c
index bf9121eb0..5359c280e 100644
--- a/src/topology/test_gnunet_daemon_topology.c
+++ b/src/topology/test_gnunet_daemon_topology.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -28,7 +28,7 @@
28 28
29#define NUM_PEERS 8 29#define NUM_PEERS 8
30 30
31/* 31/*
32 * The threshold defines the number of connection that are needed 32 * The threshold defines the number of connection that are needed
33 * for one peer to pass the test. Be aware that setting NUM_PEERS 33 * for one peer to pass the test. Be aware that setting NUM_PEERS
34 * too high can cause bandwidth problems for the testing peers. 34 * too high can cause bandwidth problems for the testing peers.
@@ -69,7 +69,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_tid;
69/* 69/*
70 * Peer context for every testbed peer. 70 * Peer context for every testbed peer.
71 */ 71 */
72struct peerctx 72struct peerctx
73{ 73{
74 int index; 74 int index;
75 struct GNUNET_STATISTICS_Handle *statistics; 75 struct GNUNET_STATISTICS_Handle *statistics;
@@ -108,7 +108,7 @@ timeout_task (void *cls)
108 108
109/* 109/*
110 * The function is called every time the topology of connected 110 * The function is called every time the topology of connected
111 * peers to a peer changes. 111 * peers to a peer changes.
112 */ 112 */
113int 113int
114statistics_iterator (void *cls, 114statistics_iterator (void *cls,
@@ -120,10 +120,10 @@ statistics_iterator (void *cls,
120 struct peerctx *p_ctx = (struct peerctx*) cls; 120 struct peerctx *p_ctx = (struct peerctx*) cls;
121 121
122 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 122 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
123 "Peer %d: %s = %d\n", 123 "Peer %d: %s = %llu\n",
124 p_ctx->index, 124 p_ctx->index,
125 name, 125 name,
126 value); 126 (unsigned long long) value);
127 127
128 if (p_ctx->connections < value) 128 if (p_ctx->connections < value)
129 p_ctx->connections = value; 129 p_ctx->connections = value;
@@ -152,7 +152,7 @@ static void *
152ca_statistics (void *cls, 152ca_statistics (void *cls,
153 const struct GNUNET_CONFIGURATION_Handle *cfg) 153 const struct GNUNET_CONFIGURATION_Handle *cfg)
154{ 154{
155 return GNUNET_STATISTICS_create ("topology", cfg); 155 return GNUNET_STATISTICS_create ("topology", cfg);
156} 156}
157 157
158 158
@@ -161,7 +161,7 @@ da_statistics (void *cls,
161 void *op_result) 161 void *op_result)
162{ 162{
163 struct peerctx *p_ctx = (struct peerctx *) cls; 163 struct peerctx *p_ctx = (struct peerctx *) cls;
164 164
165 GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch_cancel 165 GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch_cancel
166 (p_ctx->statistics, "topology", "# peers connected", 166 (p_ctx->statistics, "topology", "# peers connected",
167 statistics_iterator, p_ctx)); 167 statistics_iterator, p_ctx));
@@ -172,8 +172,8 @@ da_statistics (void *cls,
172 GNUNET_free (p_ctx); 172 GNUNET_free (p_ctx);
173} 173}
174 174
175 175
176static void 176static void
177service_connect_complete (void *cls, 177service_connect_complete (void *cls,
178 struct GNUNET_TESTBED_Operation *op, 178 struct GNUNET_TESTBED_Operation *op,
179 void *ca_result, 179 void *ca_result,
@@ -182,7 +182,7 @@ service_connect_complete (void *cls,
182 int ret; 182 int ret;
183 struct peerctx *p_ctx = (struct peerctx*) cls; 183 struct peerctx *p_ctx = (struct peerctx*) cls;
184 184
185 if (NULL == ca_result) 185 if (NULL == ca_result)
186 GNUNET_SCHEDULER_shutdown(); 186 GNUNET_SCHEDULER_shutdown();
187 187
188 p_ctx->statistics = ca_result; 188 p_ctx->statistics = ca_result;
@@ -245,20 +245,20 @@ do_connect (void *cls,
245 peers[i], peers[i+1]); 245 peers[i], peers[i+1]);
246 } 246 }
247 247
248 op[i] = 248 op[i] =
249 GNUNET_TESTBED_service_connect (cls, 249 GNUNET_TESTBED_service_connect (cls,
250 peers[i], 250 peers[i],
251 "statistics", 251 "statistics",
252 service_connect_complete, 252 service_connect_complete,
253 p_ctx, /* cls of completion cb */ 253 p_ctx, /* cls of completion cb */
254 ca_statistics, /* connect adapter */ 254 ca_statistics, /* connect adapter */
255 da_statistics, /* disconnect adapter */ 255 da_statistics, /* disconnect adapter */
256 p_ctx); 256 p_ctx);
257 257
258 } 258 }
259 259
260 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 260 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
261 timeout_tid = 261 timeout_tid =
262 GNUNET_SCHEDULER_add_delayed (TIMEOUT, 262 GNUNET_SCHEDULER_add_delayed (TIMEOUT,
263 &timeout_task, 263 &timeout_task,
264 NULL); 264 NULL);