fixing confs
authorChristian Grothoff <christian@grothoff.org>
Fri, 10 Jun 2011 09:43:54 +0000 (09:43 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 10 Jun 2011 09:43:54 +0000 (09:43 +0000)
12 files changed:
src/core/test_core_api.c
src/core/test_core_api_peer1.conf
src/core/test_core_api_peer2.conf
src/core/test_core_api_send_to_self.conf
src/core/test_core_quota_asymmetric_recv_limited_peer1.conf
src/core/test_core_quota_asymmetric_recv_limited_peer2.conf
src/core/test_core_quota_asymmetric_send_limit_peer1.conf
src/core/test_core_quota_asymmetric_send_limit_peer2.conf
src/core/test_core_quota_asymmetric_send_limited_peer1.conf
src/core/test_core_quota_asymmetric_send_limited_peer2.conf
src/core/test_core_quota_peer1.conf
src/core/test_core_quota_peer2.conf

index 212dd9d5fb82e88a3df9b28267325c50502a2a81..c7f73120d492e68a50371ba8f90acb6fd490ed86 100644 (file)
@@ -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
index 2691e1b5ca68c7f5db91ec0862abb84006fe0e4e..75196b1e766dd9853f0add0bd92d1bb534588c2a 100644 (file)
@@ -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
index 391132b612bdc1ea8cc1fd2d98da1eb04a71e2e3..b0012e7bcb54aee79e815abf9652e93303f4ac37 100644 (file)
@@ -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
index 7518456b83810d8ff417f16dc2420a52468bfef6..b3a8775b0da3c4948e40e02815b613908f0611d7 100644 (file)
@@ -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
index 0e2626623f46aaf54a7ed93d33c1a78d2768f027..94bd3356551e759272e65ddf0d5bdc3a8a05c020 100644 (file)
@@ -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
index 43e39a0690facffc6ddc621293c5e243ff44e698..8352975095573495c40fa08f91ddc74c567eed57 100644 (file)
@@ -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
index d406a6c88d66a3da515ec6e6874acc931eeb4ba5..e49bc21cc3034a590185351f31b358b820eadefa 100644 (file)
@@ -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
index 68b14f33a7fc8ec72048d33936b634118ff45d0b..4de735b3930016631d3122b552204bceb70b09f8 100644 (file)
@@ -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
index 5a963b93d56d43eb075c875a41c8ee4abe4d70c4..3195ea5afa123150386f7c1b4078238cf6c6274d 100644 (file)
@@ -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
index 54783eafe750e5ef2ea4f7425d511245d33efc67..260112b1fc220114dca8436accc6255e1ef5474f 100644 (file)
@@ -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
index 9c006b39f748b94101da2bd6a7368ab871a73dd2..7b8d776b139933641f2db01a608b7e120559563a 100644 (file)
@@ -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
index 665d3ebff937c06d474e7dc571c3ffefc606b36a..7784c25f9a113a5f1ab2ac3e17ef1fd010fe391c 100644 (file)
@@ -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