aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.conf.in1
-rw-r--r--src/core/test_core_api.c27
-rw-r--r--src/core/test_core_api_reliability.c13
-rw-r--r--src/core/test_core_quota_asymmetric_recv_limited_peer1.conf1
-rw-r--r--src/core/test_core_quota_asymmetric_recv_limited_peer2.conf1
-rw-r--r--src/core/test_core_quota_asymmetric_send_limit_peer1.conf1
-rw-r--r--src/core/test_core_quota_asymmetric_send_limit_peer2.conf1
-rw-r--r--src/core/test_core_quota_compliance.c10
-rw-r--r--src/core/test_core_quota_peer1.conf1
-rw-r--r--src/core/test_core_quota_peer2.conf1
10 files changed, 8 insertions, 49 deletions
diff --git a/src/core/core.conf.in b/src/core/core.conf.in
index fbe2f7948..ad39a8a79 100644
--- a/src/core/core.conf.in
+++ b/src/core/core.conf.in
@@ -10,7 +10,6 @@ UNIXPATH = /tmp/gnunet-service-core.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12# DISABLE_SOCKET_FORWARDING = NO 12# DISABLE_SOCKET_FORWARDING = NO
13# DEBUG = YES
14# USERNAME = 13# USERNAME =
15# MAXBUF = 14# MAXBUF =
16# TIMEOUT = 15# TIMEOUT =
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index 11fd14504..68ae39df2 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -31,10 +31,6 @@
31#include "gnunet_scheduler_lib.h" 31#include "gnunet_scheduler_lib.h"
32#include "gnunet_transport_service.h" 32#include "gnunet_transport_service.h"
33 33
34#define VERBOSE GNUNET_NO
35
36#define START_ARM GNUNET_YES
37
38#define MTYPE 12345 34#define MTYPE 12345
39 35
40struct PeerContext 36struct PeerContext
@@ -46,9 +42,7 @@ struct PeerContext
46 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 42 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
47 struct GNUNET_MessageHeader *hello; 43 struct GNUNET_MessageHeader *hello;
48 int connect_status; 44 int connect_status;
49#if START_ARM
50 struct GNUNET_OS_Process *arm_proc; 45 struct GNUNET_OS_Process *arm_proc;
51#endif
52}; 46};
53 47
54static struct PeerContext p1; 48static struct PeerContext p1;
@@ -61,11 +55,7 @@ static GNUNET_SCHEDULER_TaskIdentifier con_task;
61 55
62static int ok; 56static int ok;
63 57
64#if VERBOSE
65#define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) 58#define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
66#else
67#define OKPP do { ok++; } while (0)
68#endif
69 59
70 60
71static void 61static void
@@ -111,9 +101,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
111static void 101static void
112terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 102terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
113{ 103{
114#if VERBOSE 104 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
115 FPRINTF (stderr, "ENDING ANGRILY %u\n", ok); 105 "ENDING ANGRILY %u\n", ok);
116#endif
117 GNUNET_break (0); 106 GNUNET_break (0);
118 if (NULL != p1.ch) 107 if (NULL != p1.ch)
119 { 108 {
@@ -320,14 +309,12 @@ setup_peer (struct PeerContext *p, const char *cfgname)
320 309
321 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 310 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
322 p->cfg = GNUNET_CONFIGURATION_create (); 311 p->cfg = GNUNET_CONFIGURATION_create ();
323#if START_ARM
324 p->arm_proc = 312 p->arm_proc =
325 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 313 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
326 NULL, NULL, 314 NULL, NULL,
327 binary, 315 binary,
328 "gnunet-service-arm", 316 "gnunet-service-arm",
329 "-c", cfgname, NULL); 317 "-c", cfgname, NULL);
330#endif
331 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 318 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
332 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); 319 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
333 GNUNET_assert (p->th != NULL); 320 GNUNET_assert (p->th != NULL);
@@ -358,7 +345,6 @@ run (void *cls, char *const *args, const char *cfgfile,
358static void 345static void
359stop_arm (struct PeerContext *p) 346stop_arm (struct PeerContext *p)
360{ 347{
361#if START_ARM
362 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) 348 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
363 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 349 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
364 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) 350 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
@@ -367,19 +353,16 @@ stop_arm (struct PeerContext *p)
367 GNUNET_OS_process_get_pid (p->arm_proc)); 353 GNUNET_OS_process_get_pid (p->arm_proc));
368 GNUNET_OS_process_destroy (p->arm_proc); 354 GNUNET_OS_process_destroy (p->arm_proc);
369 p->arm_proc = NULL; 355 p->arm_proc = NULL;
370#endif
371 GNUNET_CONFIGURATION_destroy (p->cfg); 356 GNUNET_CONFIGURATION_destroy (p->cfg);
372} 357}
373 358
359
374static int 360static int
375check () 361check ()
376{ 362{
377 char *const argv[] = { "test-core-api", 363 char *const argv[] = { "test-core-api",
378 "-c", 364 "-c",
379 "test_core_api_data.conf", 365 "test_core_api_data.conf",
380#if VERBOSE
381 "-L", "DEBUG",
382#endif
383 NULL 366 NULL
384 }; 367 };
385 struct GNUNET_GETOPT_CommandLineOption options[] = { 368 struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -399,11 +382,7 @@ main (int argc, char *argv[])
399 int ret; 382 int ret;
400 383
401 GNUNET_log_setup ("test-core-api", 384 GNUNET_log_setup ("test-core-api",
402#if VERBOSE
403 "DEBUG",
404#else
405 "WARNING", 385 "WARNING",
406#endif
407 NULL); 386 NULL);
408 ret = check (); 387 ret = check ();
409 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1"); 388 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 dd70d438a..38c40da12 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -33,8 +33,6 @@
33#include "gnunet_transport_service.h" 33#include "gnunet_transport_service.h"
34#include <gauger.h> 34#include <gauger.h>
35 35
36#define START_ARM GNUNET_YES
37
38/** 36/**
39 * Note that this value must not significantly exceed 37 * Note that this value must not significantly exceed
40 * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise 38 * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
@@ -73,9 +71,7 @@ struct PeerContext
73 struct GNUNET_MessageHeader *hello; 71 struct GNUNET_MessageHeader *hello;
74 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 72 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
75 int connect_status; 73 int connect_status;
76#if START_ARM
77 struct GNUNET_OS_Process *arm_proc; 74 struct GNUNET_OS_Process *arm_proc;
78#endif
79}; 75};
80 76
81static struct PeerContext p1; 77static struct PeerContext p1;
@@ -121,8 +117,10 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
121 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); 117 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
122 GNUNET_CORE_disconnect (p1.ch); 118 GNUNET_CORE_disconnect (p1.ch);
123 p1.ch = NULL; 119 p1.ch = NULL;
120 GNUNET_free_non_null (p1.hello);
124 GNUNET_CORE_disconnect (p2.ch); 121 GNUNET_CORE_disconnect (p2.ch);
125 p2.ch = NULL; 122 p2.ch = NULL;
123 GNUNET_free_non_null (p2.hello);
126 if (connect_task != GNUNET_SCHEDULER_NO_TASK) 124 if (connect_task != GNUNET_SCHEDULER_NO_TASK)
127 GNUNET_SCHEDULER_cancel (connect_task); 125 GNUNET_SCHEDULER_cancel (connect_task);
128 GNUNET_TRANSPORT_disconnect (p1.th); 126 GNUNET_TRANSPORT_disconnect (p1.th);
@@ -409,8 +407,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
409 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 407 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
410 "Received (my) `%s' from transport service\n", "HELLO"); 408 "Received (my) `%s' from transport service\n", "HELLO");
411 GNUNET_assert (message != NULL); 409 GNUNET_assert (message != NULL);
412 p->hello = GNUNET_malloc (ntohs (message->size)); 410 p->hello = GNUNET_copy_message (message);
413 memcpy (p->hello, message, ntohs (message->size));
414 if ((p == &p1) && (p2.th != NULL)) 411 if ((p == &p1) && (p2.th != NULL))
415 GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); 412 GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
416 if ((p == &p2) && (p1.th != NULL)) 413 if ((p == &p2) && (p1.th != NULL))
@@ -430,12 +427,10 @@ setup_peer (struct PeerContext *p, const char *cfgname)
430 427
431 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 428 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
432 p->cfg = GNUNET_CONFIGURATION_create (); 429 p->cfg = GNUNET_CONFIGURATION_create ();
433#if START_ARM
434 p->arm_proc = 430 p->arm_proc =
435 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, 431 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
436 "gnunet-service-arm", 432 "gnunet-service-arm",
437 "-c", cfgname, NULL); 433 "-c", cfgname, NULL);
438#endif
439 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 434 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
440 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); 435 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
441 GNUNET_assert (p->th != NULL); 436 GNUNET_assert (p->th != NULL);
@@ -463,7 +458,6 @@ run (void *cls, char *const *args, const char *cfgfile,
463static void 458static void
464stop_arm (struct PeerContext *p) 459stop_arm (struct PeerContext *p)
465{ 460{
466#if START_ARM
467 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) 461 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
468 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 462 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
469 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) 463 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
@@ -472,7 +466,6 @@ stop_arm (struct PeerContext *p)
472 GNUNET_OS_process_get_pid (p->arm_proc)); 466 GNUNET_OS_process_get_pid (p->arm_proc));
473 GNUNET_OS_process_destroy (p->arm_proc); 467 GNUNET_OS_process_destroy (p->arm_proc);
474 p->arm_proc = NULL; 468 p->arm_proc = NULL;
475#endif
476 GNUNET_CONFIGURATION_destroy (p->cfg); 469 GNUNET_CONFIGURATION_destroy (p->cfg);
477} 470}
478 471
diff --git a/src/core/test_core_quota_asymmetric_recv_limited_peer1.conf b/src/core/test_core_quota_asymmetric_recv_limited_peer1.conf
index dcd886280..25eb25b96 100644
--- a/src/core/test_core_quota_asymmetric_recv_limited_peer1.conf
+++ b/src/core/test_core_quota_asymmetric_recv_limited_peer1.conf
@@ -34,5 +34,4 @@ WAN_QUOTA_OUT = 1 MB
34[core] 34[core]
35PORT = 12490 35PORT = 12490
36UNIXPATH = /tmp/gnunet-core-asym-recv-p1-service-core.sock 36UNIXPATH = /tmp/gnunet-core-asym-recv-p1-service-core.sock
37DEBUG = NO
38 37
diff --git a/src/core/test_core_quota_asymmetric_recv_limited_peer2.conf b/src/core/test_core_quota_asymmetric_recv_limited_peer2.conf
index 13f29e91a..062f12ae6 100644
--- a/src/core/test_core_quota_asymmetric_recv_limited_peer2.conf
+++ b/src/core/test_core_quota_asymmetric_recv_limited_peer2.conf
@@ -26,7 +26,6 @@ UNIXPATH = /tmp/gnunet-core-asym-recv-p2-service-transport.sock
26[core] 26[core]
27PORT = 22490 27PORT = 22490
28UNIXPATH = /tmp/gnunet-core-asym-recv-p2-service-core.sock 28UNIXPATH = /tmp/gnunet-core-asym-recv-p2-service-core.sock
29DEBUG = NO
30 29
31[ats] 30[ats]
32PORT = 22491 31PORT = 22491
diff --git a/src/core/test_core_quota_asymmetric_send_limit_peer1.conf b/src/core/test_core_quota_asymmetric_send_limit_peer1.conf
index 09c4ed049..36d60f1ac 100644
--- a/src/core/test_core_quota_asymmetric_send_limit_peer1.conf
+++ b/src/core/test_core_quota_asymmetric_send_limit_peer1.conf
@@ -34,4 +34,3 @@ UNIXPATH = /tmp/gnunet-core-asym-send-p1-service-ats.sock
34[core] 34[core]
35PORT = 12490 35PORT = 12490
36UNIXPATH = /tmp/gnunet-core-asym-send-p1-service-core.sock 36UNIXPATH = /tmp/gnunet-core-asym-send-p1-service-core.sock
37DEBUG = NO
diff --git a/src/core/test_core_quota_asymmetric_send_limit_peer2.conf b/src/core/test_core_quota_asymmetric_send_limit_peer2.conf
index 03d5bce12..b6e417483 100644
--- a/src/core/test_core_quota_asymmetric_send_limit_peer2.conf
+++ b/src/core/test_core_quota_asymmetric_send_limit_peer2.conf
@@ -25,7 +25,6 @@ UNIXPATH = /tmp/gnunet-core-asym-send-p2-service-transport.sock
25[core] 25[core]
26PORT = 22490 26PORT = 22490
27UNIXPATH = /tmp/gnunet-core-asym-send-p2-service-core.sock 27UNIXPATH = /tmp/gnunet-core-asym-send-p2-service-core.sock
28DEBUG = NO
29 28
30[ats] 29[ats]
31PORT = 22491 30PORT = 22491
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 88a915095..7f675a637 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -38,8 +38,6 @@
38#define ASYMMETRIC_SEND_LIMITED 1 38#define ASYMMETRIC_SEND_LIMITED 1
39#define ASYMMETRIC_RECV_LIMITED 2 39#define ASYMMETRIC_RECV_LIMITED 2
40 40
41#define START_ARM GNUNET_YES
42
43/** 41/**
44 * Note that this value must not significantly exceed 42 * Note that this value must not significantly exceed
45 * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise 43 * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
@@ -84,9 +82,7 @@ struct PeerContext
84 struct GNUNET_STATISTICS_Handle *stats; 82 struct GNUNET_STATISTICS_Handle *stats;
85 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 83 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
86 int connect_status; 84 int connect_status;
87#if START_ARM
88 struct GNUNET_OS_Process *arm_proc; 85 struct GNUNET_OS_Process *arm_proc;
89#endif
90}; 86};
91 87
92static struct PeerContext p1; 88static struct PeerContext p1;
@@ -146,6 +142,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
146 p1.th = NULL; 142 p1.th = NULL;
147 GNUNET_TRANSPORT_disconnect (p2.th); 143 GNUNET_TRANSPORT_disconnect (p2.th);
148 p2.th = NULL; 144 p2.th = NULL;
145 GNUNET_free_non_null (p1.hello);
146 GNUNET_free_non_null (p2.hello);
149} 147}
150 148
151 149
@@ -574,12 +572,10 @@ setup_peer (struct PeerContext *p, const char *cfgname)
574 572
575 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 573 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
576 p->cfg = GNUNET_CONFIGURATION_create (); 574 p->cfg = GNUNET_CONFIGURATION_create ();
577#if START_ARM
578 p->arm_proc = 575 p->arm_proc =
579 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, 576 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
580 "gnunet-service-arm", 577 "gnunet-service-arm",
581 "-c", cfgname, NULL); 578 "-c", cfgname, NULL);
582#endif
583 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 579 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
584 p->stats = GNUNET_STATISTICS_create ("core", p->cfg); 580 p->stats = GNUNET_STATISTICS_create ("core", p->cfg);
585 GNUNET_assert (p->stats != NULL); 581 GNUNET_assert (p->stats != NULL);
@@ -642,7 +638,6 @@ run (void *cls, char *const *args, const char *cfgfile,
642static void 638static void
643stop_arm (struct PeerContext *p) 639stop_arm (struct PeerContext *p)
644{ 640{
645#if START_ARM
646 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) 641 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
647 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 642 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
648 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) 643 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
@@ -651,7 +646,6 @@ stop_arm (struct PeerContext *p)
651 GNUNET_OS_process_get_pid (p->arm_proc)); 646 GNUNET_OS_process_get_pid (p->arm_proc));
652 GNUNET_OS_process_destroy (p->arm_proc); 647 GNUNET_OS_process_destroy (p->arm_proc);
653 p->arm_proc = NULL; 648 p->arm_proc = NULL;
654#endif
655 GNUNET_CONFIGURATION_destroy (p->cfg); 649 GNUNET_CONFIGURATION_destroy (p->cfg);
656} 650}
657 651
diff --git a/src/core/test_core_quota_peer1.conf b/src/core/test_core_quota_peer1.conf
index 4a67bfe66..43ef84505 100644
--- a/src/core/test_core_quota_peer1.conf
+++ b/src/core/test_core_quota_peer1.conf
@@ -32,7 +32,6 @@ WAN_QUOTA_OUT = 10240
32[core] 32[core]
33PORT = 12480 33PORT = 12480
34UNIXPATH = /tmp/gnunet-core-sym-p1-service-core.sock 34UNIXPATH = /tmp/gnunet-core-sym-p1-service-core.sock
35DEBUG = NO
36 35
37[ats] 36[ats]
38PORT = 12481 37PORT = 12481
diff --git a/src/core/test_core_quota_peer2.conf b/src/core/test_core_quota_peer2.conf
index e288da064..b100f9fb4 100644
--- a/src/core/test_core_quota_peer2.conf
+++ b/src/core/test_core_quota_peer2.conf
@@ -25,7 +25,6 @@ UNIXPATH = /tmp/gnunet-core-sym-p2-service-transport.sock
25[core] 25[core]
26PORT = 22480 26PORT = 22480
27UNIXPATH = /tmp/gnunet-core-sym-p2-service-core.sock 27UNIXPATH = /tmp/gnunet-core-sym-p2-service-core.sock
28DEBUG = NO
29 28
30[ats] 29[ats]
31PORT = 22482 30PORT = 22482