stuff
[oweals/gnunet.git] / src / transport / test_quota_compliance.c
index 26d6f4bf676125bcec52c1b7261ec7e01a1bbe02..921fa954218d4590a26afd00d01e4b936d60afb1 100644 (file)
@@ -304,16 +304,10 @@ notify_ready (void *cls, size_t size, void *buf)
       memset (&cbuf[ret], last_msg_sent, s - sizeof (struct TestMessage));
       ret += s - sizeof (struct TestMessage);
 #if DEBUG_MEASUREMENT
-      if (n % 5000 == 0)
-       {
-          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                      "Sending message %u\n",n);
-       }
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Sending message %u\n",
+                 last_msg_sent);
 #endif
-
-    /*      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                      "Sending message %u\n",last_msg_sent);*/
-
       s = get_size ();
       if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16))
        break; /* sometimes pack buffer full, sometimes not */
@@ -561,10 +555,12 @@ exchange_hello_last (void *cls,
   struct PeerContext *me = cls;
 
   GNUNET_assert (message != NULL);
+#if DEBUG_CONNECTIONS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Exchanging HELLO of size %d with peer (%s)!\n", 
              (int) GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message),
              GNUNET_i2s (&me->id));
+#endif
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *)
                                       message, &me->id));
@@ -583,10 +579,12 @@ exchange_hello (void *cls,
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *)
                                       message, &me->id));
+#if DEBUG_CONNECTIONS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Exchanging HELLO of size %d from peer %s!\n", 
              (int) GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message),
              GNUNET_i2s (&me->id));
+#endif
   GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
 }
 
@@ -617,8 +615,11 @@ notify_connect (void *cls,
     }
   if (connected == 2)
     {
-      GNUNET_SCHEDULER_cancel (tct);
-      tct = GNUNET_SCHEDULER_NO_TASK;
+      if (GNUNET_SCHEDULER_NO_TASK != tct)
+       {
+         GNUNET_SCHEDULER_cancel (tct);
+         tct = GNUNET_SCHEDULER_NO_TASK;
+       }
       GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2);
       GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1);
       if (is_asymmetric_send_constant == GNUNET_YES)
@@ -634,6 +635,14 @@ notify_connect (void *cls,
 static void
 notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
+  if (cls == &p2)
+    {
+      if (NULL != transmit_handle)
+       {
+         GNUNET_TRANSPORT_notify_transmit_ready_cancel (transmit_handle);
+         transmit_handle = NULL;
+       }
+    }
   connected--;
 #if DEBUG_CONNECTIONS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -677,8 +686,10 @@ static void
 try_connect (void *cls,
             const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+#if DEBUG_CONNECTIONS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Asking peers to connect...\n");
+#endif
   GNUNET_TRANSPORT_try_connect (p2.th,
                                &p1.id);
   GNUNET_TRANSPORT_try_connect (p1.th,
@@ -806,9 +817,6 @@ main (int argc, char *argv[])
   if (strstr(argv[0], "tcp_nat") != NULL)
     {
       is_tcp_nat = GNUNET_YES;
-#ifdef MINGW
-      return 0;
-#endif
     }
   else if (strstr(argv[0], "tcp") != NULL)
     {
@@ -817,9 +825,6 @@ main (int argc, char *argv[])
   else if (strstr(argv[0], "https") != NULL)
     {
       is_https = GNUNET_YES;
-#ifdef MINGW
-      return 0;
-#endif
     }
   else if (strstr(argv[0], "http") != NULL)
     {