From: Christian Grothoff Date: Fri, 10 Jun 2011 09:43:54 +0000 (+0000) Subject: fixing confs X-Git-Tag: initial-import-from-subversion-38251~18280 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8adc5b8550b47b708777a09956a80c5ea273d461;p=oweals%2Fgnunet.git fixing confs --- diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 212dd9d5f..c7f73120d 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -58,6 +58,8 @@ static struct PeerContext p2; static GNUNET_SCHEDULER_TaskIdentifier err_task; +static GNUNET_SCHEDULER_TaskIdentifier con_task; + static int ok; #if VERBOSE @@ -67,6 +69,22 @@ static int ok; #endif +static void +process_hello (void *cls, + const struct GNUNET_MessageHeader *message) +{ + struct PeerContext *p = cls; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received (my) `%s' from transport service\n", + "HELLO"); + GNUNET_assert (message != NULL); + if ((p == &p1) && (p2.th != NULL)) + GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); + if ((p == &p2) && (p1.th != NULL)) + GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL); +} + static void terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -74,6 +92,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_assert (ok == 6); GNUNET_CORE_disconnect (p1.ch); GNUNET_CORE_disconnect (p2.ch); + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); GNUNET_TRANSPORT_disconnect (p1.th); GNUNET_TRANSPORT_disconnect (p2.th); ok = 0; @@ -89,6 +109,8 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (0); GNUNET_CORE_disconnect (p1.ch); GNUNET_CORE_disconnect (p2.ch); + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); GNUNET_TRANSPORT_disconnect (p1.th); GNUNET_TRANSPORT_disconnect (p2.th); ok = 42; @@ -108,10 +130,6 @@ transmit_ready (void *cls, size_t size, void *buf) m = (struct GNUNET_MessageHeader *) buf; m->type = htons (MTYPE); m->size = htons (sizeof (struct GNUNET_MessageHeader)); - err_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120), - &terminate_task_error, NULL); - return sizeof (struct GNUNET_MessageHeader); } @@ -128,12 +146,17 @@ connect_notify (void *cls, sizeof (struct GNUNET_PeerIdentity))) return; GNUNET_assert (pc->connect_status == 0); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Encrypted connection established to peer `%4s'\n", + GNUNET_i2s (peer)); + if (GNUNET_SCHEDULER_NO_TASK != con_task) + { + GNUNET_SCHEDULER_cancel (con_task); + con_task = GNUNET_SCHEDULER_NO_TASK; + } pc->connect_status = 1; if (pc == &p1) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Encrypted connection established to peer `%4s'\n", - GNUNET_i2s (peer)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking core (1) for transmission to peer `%4s'\n", GNUNET_i2s (&p2.id)); @@ -206,7 +229,7 @@ process_mtype (void *cls, GNUNET_assert (ok == 5); OKPP; GNUNET_SCHEDULER_cancel (err_task); - GNUNET_SCHEDULER_add_now (&terminate_task, NULL); + err_task = GNUNET_SCHEDULER_add_now (&terminate_task, NULL); return GNUNET_OK; } @@ -217,6 +240,26 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { }; +static void +connect_task (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) + { + con_task = GNUNET_SCHEDULER_NO_TASK; + return; + } + con_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, + &connect_task, + NULL); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Asking core (1) to connect to peer `%4s'\n", + GNUNET_i2s (&p2.id)); + GNUNET_CORE_peer_request_connect (p1.ch, + &p2.id, + NULL, NULL); +} + static void init_notify (void *cls, struct GNUNET_CORE_Handle *server, @@ -236,57 +279,27 @@ init_notify (void *cls, GNUNET_assert (ok == 2); OKPP; /* connect p2 */ - GNUNET_CORE_connect (p2.cfg, 1, - &p2, - &init_notify, - &connect_notify, - &disconnect_notify, - NULL, - &inbound_notify, - GNUNET_YES, - &outbound_notify, GNUNET_YES, handlers); + p2.ch = GNUNET_CORE_connect (p2.cfg, 1, + &p2, + &init_notify, + &connect_notify, + &disconnect_notify, + NULL, + &inbound_notify, + GNUNET_YES, + &outbound_notify, GNUNET_YES, handlers); } else { GNUNET_assert (ok == 3); OKPP; GNUNET_assert (cls == &p2); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Asking core (1) to connect to peer `%4s'\n", - GNUNET_i2s (&p2.id)); - GNUNET_CORE_peer_request_connect (p1.ch, - &p2.id, - NULL, NULL); + con_task = GNUNET_SCHEDULER_add_now (&connect_task, + NULL); } } -static void -process_hello (void *cls, - const struct GNUNET_MessageHeader *message) -{ - struct PeerContext *p = cls; - - GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received (my) `%s' from transport service\n", - "HELLO"); - GNUNET_assert (message != NULL); - p->hello = GNUNET_malloc (ntohs (message->size)); - memcpy (p->hello, message, ntohs (message->size)); - if ((p == &p1) && (p2.th != NULL)) - GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); - if ((p == &p2) && (p1.th != NULL)) - GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL); - - if ((p == &p1) && (p2.hello != NULL)) - GNUNET_TRANSPORT_offer_hello (p1.th, p2.hello, NULL, NULL); - if ((p == &p2) && (p1.hello != NULL)) - GNUNET_TRANSPORT_offer_hello (p2.th, p1.hello, NULL, NULL); -} - - - static void setup_peer (struct PeerContext *p, const char *cfgname) { @@ -316,14 +329,17 @@ run (void *cls, OKPP; setup_peer (&p1, "test_core_api_peer1.conf"); setup_peer (&p2, "test_core_api_peer2.conf"); - GNUNET_CORE_connect (p1.cfg, 1, - &p1, - &init_notify, - &connect_notify, - &disconnect_notify, - NULL, - &inbound_notify, - GNUNET_YES, &outbound_notify, GNUNET_YES, handlers); + err_task = + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120), + &terminate_task_error, NULL); + p1.ch = GNUNET_CORE_connect (p1.cfg, 1, + &p1, + &init_notify, + &connect_notify, + &disconnect_notify, + NULL, + &inbound_notify, + GNUNET_YES, &outbound_notify, GNUNET_YES, handlers); } static void diff --git a/src/core/test_core_api_peer1.conf b/src/core/test_core_api_peer1.conf index 2691e1b5c..75196b1e7 100644 --- a/src/core/test_core_api_peer1.conf +++ b/src/core/test_core_api_peer1.conf @@ -16,7 +16,7 @@ PLUGINS = tcp #PREFIX= xterm -e xterm -T transport1 -e gdb --args #PREFIX = xterm -T transport1 -e gdb --args #PREFIX = xterm -T transport1 -e valgrind --tool=memcheck -#DEBUG = YES +DEBUG = YES [arm] PORT = 12466 @@ -34,6 +34,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 12469 UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock diff --git a/src/core/test_core_api_peer2.conf b/src/core/test_core_api_peer2.conf index 391132b61..b0012e7bc 100644 --- a/src/core/test_core_api_peer2.conf +++ b/src/core/test_core_api_peer2.conf @@ -19,6 +19,15 @@ PLUGINS = tcp #PREFIX = xterm -T transport2 -e valgrind --tool=memcheck #DEBUG = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [arm] PORT = 22466 UNIXPATH = /tmp/gnunet-p2-service-arm.sock diff --git a/src/core/test_core_api_send_to_self.conf b/src/core/test_core_api_send_to_self.conf index 7518456b8..b3a8775b0 100644 --- a/src/core/test_core_api_send_to_self.conf +++ b/src/core/test_core_api_send_to_self.conf @@ -38,7 +38,7 @@ ACCEPT_FROM6 = ::1; TOTAL_QUOTA_IN = 65536 TOTAL_QUOTA_OUT = 65536 UNIXPATH = /tmp/gnunet-service-sts.sock -DEBUG = YES +#DEBUG = YES [core] AUTOSTART = YES 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 0e2626623..94bd33565 100644 --- a/src/core/test_core_quota_asymmetric_recv_limited_peer1.conf +++ b/src/core/test_core_quota_asymmetric_recv_limited_peer1.conf @@ -35,6 +35,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 12489 UNIXPATH = /tmp/gnunet-core-asym-recv-p1-service-peerinfo.sock 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 43e39a069..835297509 100644 --- a/src/core/test_core_quota_asymmetric_recv_limited_peer2.conf +++ b/src/core/test_core_quota_asymmetric_recv_limited_peer2.conf @@ -36,6 +36,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 22489 UNIXPATH = /tmp/gnunet-core-asym-recv-p2-service-peerinfo.sock 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 d406a6c88..e49bc21cc 100644 --- a/src/core/test_core_quota_asymmetric_send_limit_peer1.conf +++ b/src/core/test_core_quota_asymmetric_send_limit_peer1.conf @@ -35,6 +35,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 12489 UNIXPATH = /tmp/gnunet-core-asym-send-p1-service-peerinfo.sock 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 68b14f33a..4de735b39 100644 --- a/src/core/test_core_quota_asymmetric_send_limit_peer2.conf +++ b/src/core/test_core_quota_asymmetric_send_limit_peer2.conf @@ -36,6 +36,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 22489 UNIXPATH = /tmp/gnunet-core-asym-send-p2-service-peerinfo.sock diff --git a/src/core/test_core_quota_asymmetric_send_limited_peer1.conf b/src/core/test_core_quota_asymmetric_send_limited_peer1.conf index 5a963b93d..3195ea5af 100644 --- a/src/core/test_core_quota_asymmetric_send_limited_peer1.conf +++ b/src/core/test_core_quota_asymmetric_send_limited_peer1.conf @@ -35,6 +35,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 12429 UNIXPATH = /tmp/gnunet-core-asym-send-p1-service-peerinfo.sock diff --git a/src/core/test_core_quota_asymmetric_send_limited_peer2.conf b/src/core/test_core_quota_asymmetric_send_limited_peer2.conf index 54783eafe..260112b1f 100644 --- a/src/core/test_core_quota_asymmetric_send_limited_peer2.conf +++ b/src/core/test_core_quota_asymmetric_send_limited_peer2.conf @@ -36,6 +36,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 22429 UNIXPATH = /tmp/gnunet-core-asym-send-p2-service-peerinfo.sock diff --git a/src/core/test_core_quota_peer1.conf b/src/core/test_core_quota_peer1.conf index 9c006b39f..7b8d776b1 100644 --- a/src/core/test_core_quota_peer1.conf +++ b/src/core/test_core_quota_peer1.conf @@ -36,6 +36,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 12479 UNIXPATH = /tmp/gnunet-core-sym-p1-service-peerinfo.sock diff --git a/src/core/test_core_quota_peer2.conf b/src/core/test_core_quota_peer2.conf index 665d3ebff..7784c25f9 100644 --- a/src/core/test_core_quota_peer2.conf +++ b/src/core/test_core_quota_peer2.conf @@ -36,6 +36,15 @@ BINDTO = 127.0.0.1 #DEBUG = YES USE_LOCALADDR = YES +[nat] +DISABLEV6 = YES +BINDTO = 127.0.0.1 +ENABLE_UPNP = NO +BEHIND_NAT = NO +ALLOW_NAT = NO +INTERNAL_ADDRESS = 127.0.0.1 +EXTERNAL_ADDRESS = 127.0.0.1 + [peerinfo] PORT = 22479 UNIXPATH = /tmp/gnunet-core-sym-p2-service-peerinfo.sock