aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-30 17:29:00 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-30 17:29:00 +0000
commit24dc89edc8d7f9eb5f23cd3e804fd9732858fbee (patch)
tree8c2062b0309958537a8e2daca5ce448625250686 /src/core
parentfc0a7982cd82e6f1915589a89c61dbe9d58aedb3 (diff)
downloadgnunet-24dc89edc8d7f9eb5f23cd3e804fd9732858fbee.tar.gz
gnunet-24dc89edc8d7f9eb5f23cd3e804fd9732858fbee.zip
converting core tests to hello_get API
Diffstat (limited to 'src/core')
-rw-r--r--src/core/test_core_api.c97
-rw-r--r--src/core/test_core_api_reliability.c55
-rw-r--r--src/core/test_core_quota_compliance.c71
3 files changed, 148 insertions, 75 deletions
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index b012aa213..3f0b77bd1 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2015 GNUnet e.V. 3 Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -26,6 +26,7 @@
26#include "gnunet_core_service.h" 26#include "gnunet_core_service.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_transport_service.h" 28#include "gnunet_transport_service.h"
29#include "gnunet_transport_hello_service.h"
29#include "gnunet_ats_service.h" 30#include "gnunet_ats_service.h"
30 31
31#define MTYPE 12345 32#define MTYPE 12345
@@ -36,7 +37,7 @@ struct PeerContext
36 struct GNUNET_CORE_Handle *ch; 37 struct GNUNET_CORE_Handle *ch;
37 struct GNUNET_PeerIdentity id; 38 struct GNUNET_PeerIdentity id;
38 struct GNUNET_TRANSPORT_OfferHelloHandle *oh; 39 struct GNUNET_TRANSPORT_OfferHelloHandle *oh;
39 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 40 struct GNUNET_TRANSPORT_HelloGetHandle *ghh;
40 struct GNUNET_ATS_ConnectivityHandle *ats; 41 struct GNUNET_ATS_ConnectivityHandle *ats;
41 struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; 42 struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
42 struct GNUNET_MessageHeader *hello; 43 struct GNUNET_MessageHeader *hello;
@@ -71,7 +72,7 @@ process_hello (void *cls,
71 struct PeerContext *p = cls; 72 struct PeerContext *p = cls;
72 73
73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 74 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
74 "Received (my) `%s' from transport service\n", "HELLO"); 75 "Received (my) HELLO from transport service\n");
75 GNUNET_assert (message != NULL); 76 GNUNET_assert (message != NULL);
76 if ((p == &p1) && (NULL == p2.oh)) 77 if ((p == &p1) && (NULL == p2.oh))
77 p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg, message, 78 p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg, message,
@@ -95,7 +96,7 @@ terminate_peer (struct PeerContext *p)
95 } 96 }
96 if (NULL != p->ghh) 97 if (NULL != p->ghh)
97 { 98 {
98 GNUNET_TRANSPORT_get_hello_cancel (p->ghh); 99 GNUNET_TRANSPORT_hello_get_cancel (p->ghh);
99 p->ghh = NULL; 100 p->ghh = NULL;
100 } 101 }
101 if (NULL != p->oh) 102 if (NULL != p->oh)
@@ -140,7 +141,9 @@ terminate_task_error (void *cls)
140 141
141 142
142static size_t 143static size_t
143transmit_ready (void *cls, size_t size, void *buf) 144transmit_ready (void *cls,
145 size_t size,
146 void *buf)
144{ 147{
145 struct PeerContext *p = cls; 148 struct PeerContext *p = cls;
146 struct GNUNET_MessageHeader *m; 149 struct GNUNET_MessageHeader *m;
@@ -162,20 +165,23 @@ connect_notify (void *cls,
162{ 165{
163 struct PeerContext *pc = cls; 166 struct PeerContext *pc = cls;
164 167
165 if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity))) 168 if (0 == memcmp (&pc->id,
169 peer,
170 sizeof (struct GNUNET_PeerIdentity)))
166 return; 171 return;
167 GNUNET_assert (pc->connect_status == 0); 172 GNUNET_assert (pc->connect_status == 0);
168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
169 "Encrypted connection established to peer `%4s'\n", 174 "Encrypted connection established to peer `%s'\n",
170 GNUNET_i2s (peer)); 175 GNUNET_i2s (peer));
171 pc->connect_status = 1; 176 pc->connect_status = 1;
172 if (pc == &p1) 177 if (pc == &p1)
173 { 178 {
174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
175 "Asking core (1) for transmission to peer `%4s'\n", 180 "Asking core (1) for transmission to peer `%s'\n",
176 GNUNET_i2s (&p2.id)); 181 GNUNET_i2s (&p2.id));
177 if (NULL == 182 if (NULL ==
178 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_YES, 183 GNUNET_CORE_notify_transmit_ready (p1.ch,
184 GNUNET_YES,
179 GNUNET_CORE_PRIO_BEST_EFFORT, 185 GNUNET_CORE_PRIO_BEST_EFFORT,
180 GNUNET_TIME_relative_multiply 186 GNUNET_TIME_relative_multiply
181 (GNUNET_TIME_UNIT_SECONDS, 145), 187 (GNUNET_TIME_UNIT_SECONDS, 145),
@@ -184,7 +190,7 @@ connect_notify (void *cls,
184 &transmit_ready, &p1)) 190 &transmit_ready, &p1))
185 { 191 {
186 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 192 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
187 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n", 193 "RECEIVED NULL when asking core (1) for transmission to peer `%s'\n",
188 GNUNET_i2s (&p2.id)); 194 GNUNET_i2s (&p2.id));
189 } 195 }
190 } 196 }
@@ -192,34 +198,41 @@ connect_notify (void *cls,
192 198
193 199
194static void 200static void
195disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) 201disconnect_notify (void *cls,
202 const struct GNUNET_PeerIdentity *peer)
196{ 203{
197 struct PeerContext *pc = cls; 204 struct PeerContext *pc = cls;
198 205
199 if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity))) 206 if (0 == memcmp (&pc->id,
207 peer,
208 sizeof (struct GNUNET_PeerIdentity)))
200 return; 209 return;
201 pc->connect_status = 0; 210 pc->connect_status = 0;
202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted connection to `%4s' cut\n", 211 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
212 "Encrypted connection to `%s' cut\n",
203 GNUNET_i2s (peer)); 213 GNUNET_i2s (peer));
204} 214}
205 215
206 216
207static int 217static int
208inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, 218inbound_notify (void *cls,
219 const struct GNUNET_PeerIdentity *other,
209 const struct GNUNET_MessageHeader *message) 220 const struct GNUNET_MessageHeader *message)
210{ 221{
211 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
212 "Core provides inbound data from `%4s'.\n", GNUNET_i2s (other)); 223 "Core provides inbound data from `%s'.\n",
224 GNUNET_i2s (other));
213 return GNUNET_OK; 225 return GNUNET_OK;
214} 226}
215 227
216 228
217static int 229static int
218outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, 230outbound_notify (void *cls,
231 const struct GNUNET_PeerIdentity *other,
219 const struct GNUNET_MessageHeader *message) 232 const struct GNUNET_MessageHeader *message)
220{ 233{
221 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
222 "Core notifies about outbound data for `%4s'.\n", 235 "Core notifies about outbound data for `%s'.\n",
223 GNUNET_i2s (other)); 236 GNUNET_i2s (other));
224 return GNUNET_OK; 237 return GNUNET_OK;
225} 238}
@@ -231,12 +244,13 @@ process_mtype (void *cls,
231 const struct GNUNET_MessageHeader *message) 244 const struct GNUNET_MessageHeader *message)
232{ 245{
233 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 246 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
234 "Receiving message from `%4s'.\n", 247 "Receiving message from `%s'.\n",
235 GNUNET_i2s (peer)); 248 GNUNET_i2s (peer));
236 GNUNET_assert (ok == 5); 249 GNUNET_assert (ok == 5);
237 OKPP; 250 OKPP;
238 GNUNET_SCHEDULER_cancel (err_task); 251 GNUNET_SCHEDULER_cancel (err_task);
239 err_task = GNUNET_SCHEDULER_add_now (&terminate_task, NULL); 252 err_task = GNUNET_SCHEDULER_add_now (&terminate_task,
253 NULL);
240 return GNUNET_OK; 254 return GNUNET_OK;
241} 255}
242 256
@@ -254,7 +268,7 @@ init_notify (void *cls,
254 struct PeerContext *p = cls; 268 struct PeerContext *p = cls;
255 269
256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 270 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
257 "Core connection to `%4s' established\n", 271 "Core connection to `%s' established\n",
258 GNUNET_i2s (my_identity)); 272 GNUNET_i2s (my_identity));
259 p->id = *my_identity; 273 p->id = *my_identity;
260 if (cls == &p1) 274 if (cls == &p1)
@@ -262,10 +276,14 @@ init_notify (void *cls,
262 GNUNET_assert (ok == 2); 276 GNUNET_assert (ok == 2);
263 OKPP; 277 OKPP;
264 /* connect p2 */ 278 /* connect p2 */
265 p2.ch = 279 p2.ch = GNUNET_CORE_connect (p2.cfg,
266 GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify, 280 &p2,
267 &disconnect_notify, &inbound_notify, GNUNET_YES, 281 &init_notify,
268 &outbound_notify, GNUNET_YES, handlers); 282 &connect_notify,
283 &disconnect_notify,
284 &inbound_notify, GNUNET_YES,
285 &outbound_notify, GNUNET_YES,
286 handlers);
269 } 287 }
270 else 288 else
271 { 289 {
@@ -288,15 +306,23 @@ setup_peer (struct PeerContext *p,
288 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 306 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
289 p->cfg = GNUNET_CONFIGURATION_create (); 307 p->cfg = GNUNET_CONFIGURATION_create ();
290 p->arm_proc = 308 p->arm_proc =
291 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 309 GNUNET_OS_start_process (GNUNET_YES,
310 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
292 NULL, NULL, NULL, 311 NULL, NULL, NULL,
293 binary, 312 binary,
294 "gnunet-service-arm", 313 "gnunet-service-arm",
295 "-c", cfgname, NULL); 314 "-c",
296 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 315 cfgname,
316 NULL);
317 GNUNET_assert (GNUNET_OK ==
318 GNUNET_CONFIGURATION_load (p->cfg,
319 cfgname));
297 p->ats = GNUNET_ATS_connectivity_init (p->cfg); 320 p->ats = GNUNET_ATS_connectivity_init (p->cfg);
298 GNUNET_assert (NULL != p->ats); 321 GNUNET_assert (NULL != p->ats);
299 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, &process_hello, p); 322 p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg,
323 GNUNET_TRANSPORT_AC_ANY,
324 &process_hello,
325 p);
300 GNUNET_free (binary); 326 GNUNET_free (binary);
301} 327}
302 328
@@ -342,9 +368,11 @@ stop_arm (struct PeerContext *p)
342 368
343 369
344int 370int
345main (int argc, char *argv1[]) 371main (int argc,
372 char *argv1[])
346{ 373{
347 char *const argv[] = { "test-core-api", 374 char *const argv[] = {
375 "test-core-api",
348 "-c", 376 "-c",
349 "test_core_api_data.conf", 377 "test_core_api_data.conf",
350 NULL 378 NULL
@@ -356,8 +384,13 @@ main (int argc, char *argv1[])
356 GNUNET_log_setup ("test-core-api", 384 GNUNET_log_setup ("test-core-api",
357 "WARNING", 385 "WARNING",
358 NULL); 386 NULL);
359 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, 387 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
360 "test-core-api", "nohelp", options, &run, &ok); 388 argv,
389 "test-core-api",
390 "nohelp",
391 options,
392 &run,
393 &ok);
361 stop_arm (&p1); 394 stop_arm (&p1);
362 stop_arm (&p2); 395 stop_arm (&p2);
363 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1"); 396 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index a4a6d182c..c5ee12478 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2015 GNUnet e.V. 3 Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -27,6 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_ats_service.h" 28#include "gnunet_ats_service.h"
29#include "gnunet_transport_service.h" 29#include "gnunet_transport_service.h"
30#include "gnunet_transport_hello_service.h"
30#include <gauger.h> 31#include <gauger.h>
31 32
32/** 33/**
@@ -63,7 +64,7 @@ struct PeerContext
63 struct GNUNET_PeerIdentity id; 64 struct GNUNET_PeerIdentity id;
64 struct GNUNET_TRANSPORT_OfferHelloHandle *oh; 65 struct GNUNET_TRANSPORT_OfferHelloHandle *oh;
65 struct GNUNET_MessageHeader *hello; 66 struct GNUNET_MessageHeader *hello;
66 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 67 struct GNUNET_TRANSPORT_HelloGetHandle *ghh;
67 struct GNUNET_ATS_ConnectivityHandle *ats; 68 struct GNUNET_ATS_ConnectivityHandle *ats;
68 struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; 69 struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
69 int connect_status; 70 int connect_status;
@@ -112,7 +113,7 @@ terminate_peer (struct PeerContext *p)
112 } 113 }
113 if (NULL != p->ghh) 114 if (NULL != p->ghh)
114 { 115 {
115 GNUNET_TRANSPORT_get_hello_cancel (p->ghh); 116 GNUNET_TRANSPORT_hello_get_cancel (p->ghh);
116 p->ghh = NULL; 117 p->ghh = NULL;
117 } 118 }
118 if (NULL != p->oh) 119 if (NULL != p->oh)
@@ -406,13 +407,17 @@ init_notify (void *cls,
406 GNUNET_assert (ok == 2); 407 GNUNET_assert (ok == 2);
407 OKPP; 408 OKPP;
408 /* connect p2 */ 409 /* connect p2 */
409 GNUNET_assert (NULL != (p2.ch = GNUNET_CORE_connect (p2.cfg, &p2, 410 GNUNET_assert (NULL !=
410 &init_notify, 411 (p2.ch = GNUNET_CORE_connect (p2.cfg,
411 &connect_notify, 412 &p2,
412 &disconnect_notify, 413 &init_notify,
413 &inbound_notify, GNUNET_YES, 414 &connect_notify,
414 &outbound_notify, GNUNET_YES, 415 &disconnect_notify,
415 handlers))); 416 &inbound_notify,
417 GNUNET_YES,
418 &outbound_notify,
419 GNUNET_YES,
420 handlers)));
416 } 421 }
417 else 422 else
418 { 423 {
@@ -480,18 +485,22 @@ setup_peer (struct PeerContext *p,
480 485
481 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 486 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
482 p->cfg = GNUNET_CONFIGURATION_create (); 487 p->cfg = GNUNET_CONFIGURATION_create ();
483 p->arm_proc = 488 p->arm_proc
484 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 489 = GNUNET_OS_start_process (GNUNET_YES,
485 NULL, NULL, NULL, 490 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
486 binary, 491 NULL, NULL, NULL,
487 "gnunet-service-arm", 492 binary,
488 "-c", cfgname, NULL); 493 "gnunet-service-arm",
494 "-c",
495 cfgname,
496 NULL);
489 GNUNET_assert (GNUNET_OK == 497 GNUNET_assert (GNUNET_OK ==
490 GNUNET_CONFIGURATION_load (p->cfg, 498 GNUNET_CONFIGURATION_load (p->cfg,
491 cfgname)); 499 cfgname));
492 p->ats = GNUNET_ATS_connectivity_init (p->cfg); 500 p->ats = GNUNET_ATS_connectivity_init (p->cfg);
493 GNUNET_assert (NULL != p->ats); 501 GNUNET_assert (NULL != p->ats);
494 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, 502 p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg,
503 GNUNET_TRANSPORT_AC_ANY,
495 &process_hello, 504 &process_hello,
496 p); 505 p);
497 GNUNET_free (binary); 506 GNUNET_free (binary);
@@ -506,8 +515,10 @@ run (void *cls,
506{ 515{
507 GNUNET_assert (ok == 1); 516 GNUNET_assert (ok == 1);
508 OKPP; 517 OKPP;
509 setup_peer (&p1, "test_core_api_peer1.conf"); 518 setup_peer (&p1,
510 setup_peer (&p2, "test_core_api_peer2.conf"); 519 "test_core_api_peer1.conf");
520 setup_peer (&p2,
521 "test_core_api_peer2.conf");
511 err_task = 522 err_task =
512 GNUNET_SCHEDULER_add_delayed (TIMEOUT, 523 GNUNET_SCHEDULER_add_delayed (TIMEOUT,
513 &terminate_task_error, 524 &terminate_task_error,
@@ -516,7 +527,8 @@ run (void *cls,
516 NULL); 527 NULL);
517 528
518 GNUNET_assert (NULL != 529 GNUNET_assert (NULL !=
519 (p1.ch = GNUNET_CORE_connect (p1.cfg, &p1, 530 (p1.ch = GNUNET_CORE_connect (p1.cfg,
531 &p1,
520 &init_notify, 532 &init_notify,
521 &connect_notify, 533 &connect_notify,
522 &disconnect_notify, 534 &disconnect_notify,
@@ -548,7 +560,8 @@ stop_arm (struct PeerContext *p)
548 560
549 561
550int 562int
551main (int argc, char *argv1[]) 563main (int argc,
564 char *argv1[])
552{ 565{
553 char *const argv[] = { 566 char *const argv[] = {
554 "test-core-api-reliability", 567 "test-core-api-reliability",
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 04f79b959..01eafbfe0 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2015 GNUnet e.V. 3 Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -27,6 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_ats_service.h" 28#include "gnunet_ats_service.h"
29#include "gnunet_transport_service.h" 29#include "gnunet_transport_service.h"
30#include "gnunet_transport_hello_service.h"
30#include "gnunet_statistics_service.h" 31#include "gnunet_statistics_service.h"
31 32
32 33
@@ -74,7 +75,7 @@ struct PeerContext
74 struct GNUNET_PeerIdentity id; 75 struct GNUNET_PeerIdentity id;
75 struct GNUNET_MessageHeader *hello; 76 struct GNUNET_MessageHeader *hello;
76 struct GNUNET_STATISTICS_Handle *stats; 77 struct GNUNET_STATISTICS_Handle *stats;
77 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 78 struct GNUNET_TRANSPORT_HelloGetHandle *ghh;
78 struct GNUNET_ATS_ConnectivityHandle *ats; 79 struct GNUNET_ATS_ConnectivityHandle *ats;
79 struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; 80 struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
80 int connect_status; 81 int connect_status;
@@ -124,7 +125,7 @@ terminate_peer (struct PeerContext *p)
124 } 125 }
125 if (NULL != p->ghh) 126 if (NULL != p->ghh)
126 { 127 {
127 GNUNET_TRANSPORT_get_hello_cancel (p->ghh); 128 GNUNET_TRANSPORT_hello_get_cancel (p->ghh);
128 p->ghh = NULL; 129 p->ghh = NULL;
129 } 130 }
130 if (NULL != p->oh) 131 if (NULL != p->oh)
@@ -677,17 +678,26 @@ setup_peer (struct PeerContext *p,
677 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 678 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
678 p->cfg = GNUNET_CONFIGURATION_create (); 679 p->cfg = GNUNET_CONFIGURATION_create ();
679 p->arm_proc = 680 p->arm_proc =
680 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 681 GNUNET_OS_start_process (GNUNET_YES,
682 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
681 NULL, NULL, NULL, 683 NULL, NULL, NULL,
682 binary, 684 binary,
683 "gnunet-service-arm", 685 "gnunet-service-arm",
684 "-c", cfgname, NULL); 686 "-c",
685 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 687 cfgname,
686 p->stats = GNUNET_STATISTICS_create ("core", p->cfg); 688 NULL);
687 GNUNET_assert (p->stats != NULL); 689 GNUNET_assert (GNUNET_OK ==
690 GNUNET_CONFIGURATION_load (p->cfg,
691 cfgname));
692 p->stats = GNUNET_STATISTICS_create ("core",
693 p->cfg);
694 GNUNET_assert (NULL != p->stats);
688 p->ats = GNUNET_ATS_connectivity_init (p->cfg); 695 p->ats = GNUNET_ATS_connectivity_init (p->cfg);
689 GNUNET_assert (NULL != p->ats); 696 GNUNET_assert (NULL != p->ats);
690 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, &process_hello, p); 697 p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg,
698 GNUNET_TRANSPORT_AC_ANY,
699 &process_hello,
700 p);
691 GNUNET_free (binary); 701 GNUNET_free (binary);
692} 702}
693 703
@@ -708,42 +718,59 @@ run (void *cls,
708 NULL); 718 NULL);
709 if (test == SYMMETRIC) 719 if (test == SYMMETRIC)
710 { 720 {
711 setup_peer (&p1, "test_core_quota_peer1.conf"); 721 setup_peer (&p1,
712 setup_peer (&p2, "test_core_quota_peer2.conf"); 722 "test_core_quota_peer1.conf");
723 setup_peer (&p2,
724 "test_core_quota_peer2.conf");
713 } 725 }
714 else if (test == ASYMMETRIC_SEND_LIMITED) 726 else if (test == ASYMMETRIC_SEND_LIMITED)
715 { 727 {
716 setup_peer (&p1, "test_core_quota_asymmetric_send_limit_peer1.conf"); 728 setup_peer (&p1,
717 setup_peer (&p2, "test_core_quota_asymmetric_send_limit_peer2.conf"); 729 "test_core_quota_asymmetric_send_limit_peer1.conf");
730 setup_peer (&p2,
731 "test_core_quota_asymmetric_send_limit_peer2.conf");
718 } 732 }
719 else if (test == ASYMMETRIC_RECV_LIMITED) 733 else if (test == ASYMMETRIC_RECV_LIMITED)
720 { 734 {
721 setup_peer (&p1, "test_core_quota_asymmetric_recv_limited_peer1.conf"); 735 setup_peer (&p1,
722 setup_peer (&p2, "test_core_quota_asymmetric_recv_limited_peer2.conf"); 736 "test_core_quota_asymmetric_recv_limited_peer1.conf");
737 setup_peer (&p2,
738 "test_core_quota_asymmetric_recv_limited_peer2.conf");
723 } 739 }
724 740
725 GNUNET_assert (test != -1); 741 GNUNET_assert (test != -1);
726 GNUNET_assert (GNUNET_SYSERR != 742 GNUNET_assert (GNUNET_SYSERR !=
727 GNUNET_CONFIGURATION_get_value_size (p1.cfg, "ATS", 743 GNUNET_CONFIGURATION_get_value_size (p1.cfg,
744 "ATS",
728 "WAN_QUOTA_IN", 745 "WAN_QUOTA_IN",
729 &current_quota_p1_in)); 746 &current_quota_p1_in));
730 GNUNET_assert (GNUNET_SYSERR != 747 GNUNET_assert (GNUNET_SYSERR !=
731 GNUNET_CONFIGURATION_get_value_size (p2.cfg, "ATS", 748 GNUNET_CONFIGURATION_get_value_size (p2.cfg,
749 "ATS",
732 "WAN_QUOTA_IN", 750 "WAN_QUOTA_IN",
733 &current_quota_p2_in)); 751 &current_quota_p2_in));
734 GNUNET_assert (GNUNET_SYSERR != 752 GNUNET_assert (GNUNET_SYSERR !=
735 GNUNET_CONFIGURATION_get_value_size (p1.cfg, "ATS", 753 GNUNET_CONFIGURATION_get_value_size (p1.cfg,
754 "ATS",
736 "WAN_QUOTA_OUT", 755 "WAN_QUOTA_OUT",
737 &current_quota_p1_out)); 756 &current_quota_p1_out));
738 GNUNET_assert (GNUNET_SYSERR != 757 GNUNET_assert (GNUNET_SYSERR !=
739 GNUNET_CONFIGURATION_get_value_size (p2.cfg, "ATS", 758 GNUNET_CONFIGURATION_get_value_size (p2.cfg,
759 "ATS",
740 "WAN_QUOTA_OUT", 760 "WAN_QUOTA_OUT",
741 &current_quota_p2_out)); 761 &current_quota_p2_out));
742 762
743 p1.ch = 763 p1.ch =
744 GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify, 764 GNUNET_CORE_connect (p1.cfg,
745 &disconnect_notify, &inbound_notify, GNUNET_YES, 765 &p1,
746 &outbound_notify, GNUNET_YES, handlers); 766 &init_notify,
767 &connect_notify,
768 &disconnect_notify,
769 &inbound_notify,
770 GNUNET_YES,
771 &outbound_notify,
772 GNUNET_YES,
773 handlers);
747} 774}
748 775
749 776