separate transport api debug messages from transport debugging
authorMatthias Wachs <wachs@net.in.tum.de>
Mon, 5 Sep 2011 12:31:19 +0000 (12:31 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Mon, 5 Sep 2011 12:31:19 +0000 (12:31 +0000)
re-enabling ats in validation

src/transport/gnunet-service-transport.h
src/transport/gnunet-service-transport_validation.c
src/transport/transport.h
src/transport/transport_api.c

index 17fcaa0ae07d58f5bcbae7ff6ec6444462495da6..36469df0672b9e97ba0c166721147969bc970046 100644 (file)
@@ -30,6 +30,8 @@
 #include "gnunet_transport_service.h"
 #include "gnunet_util_lib.h"
 
+#define VERBOSE_VALIDATION GNUNET_YES
+
 /**
  * Statistics handle.
  */
index 654bf52b8bf9082177c91d3bf30d96ade90f451d..cbf0bc7d2ab64b9b707c576c6016fbb9c079b759 100644 (file)
@@ -975,8 +975,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
 
   /* validity achieved, remember it! */
   ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION);
-  // FIXME: This crashes transport service
-  //  GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, NULL, 0);     /* FIXME: compute and add latency here... */
+  GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, NULL, 0);     /* FIXME: compute and add latency here... */
 
   /* build HELLO to store in PEERINFO */
   ve->copied = GNUNET_NO;
@@ -987,7 +986,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
   if (GNUNET_SCHEDULER_NO_TASK != ve->timeout_task)
     GNUNET_SCHEDULER_cancel (ve->timeout_task);
 
-  /* randomly delay by up to 1h to avoid synchronous validations */
+  /* randomly delay by up to 1h to avoid   synchronous validations */
   rdelay = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 60 * 60);
   delay =
       GNUNET_TIME_relative_add (HELLO_REVALIDATION_START_TIME,
index a694d86e55a7124b25d6683cb3328045a66c7467..89ace764ccdadcfae58e837d7ed7cbf0e927a468 100644 (file)
@@ -36,6 +36,8 @@
 
 #define DEBUG_TRANSPORT_DISCONNECT GNUNET_NO
 
+#define DEBUG_TRANSPORT_API GNUNET_NO
+
 /**
  * For how long do we allow unused bandwidth
  * from the past to carry over into the future? (in seconds)
index 94e21a7c09153ff3c312431776248dee43df31a7..bf37b4ac696b010d73d7ace6b38576da4cbadf13 100644 (file)
@@ -46,7 +46,6 @@
  */
 #define STARTING_NEIGHBOURS_SIZE 16
 
-
 /**
  * Handle for a message that should be transmitted to the service.
  * Used for both control messages and normal messages.
@@ -340,7 +339,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
 {
   struct Neighbour *n;
 
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating entry for neighbour `%4s'.\n",
               GNUNET_i2s (pid));
 #endif
@@ -412,7 +411,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
   GNUNET_assert (h->client != NULL);
   if (msg == NULL)
   {
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Error receiving from transport service, disconnecting temporarily.\n");
 #endif
@@ -431,7 +430,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break (0);
       break;
     }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Receiving (my own) `%s' message, I am `%4s'.\n", "HELLO",
                 GNUNET_i2s (&me));
@@ -469,7 +468,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break (0);
       break;
     }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n",
                 "CONNECT", GNUNET_i2s (&cim->id));
 #endif
@@ -491,7 +490,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
     }
     dim = (const struct DisconnectInfoMessage *) msg;
     GNUNET_break (ntohl (dim->reserved) == 0);
-#if DEBUG_TRANSPORT_DISCONNECT
+#if DEBUG_TRANSPORT_API_DISCONNECT
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n",
                 "DISCONNECT", GNUNET_i2s (&dim->peer));
 #endif
@@ -510,7 +509,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
       break;
     }
     okm = (const struct SendOkMessage *) msg;
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Receiving `%s' message, transmission %s.\n", "SEND_OK",
                 ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed");
@@ -532,7 +531,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
     }
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV:
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "RECV");
 #endif
     if (size <
@@ -552,7 +551,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break (0);
       break;
     }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Received message of type %u from `%4s'.\n", ntohs (imm->type),
                 GNUNET_i2s (&im->peer));
@@ -636,7 +635,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
   {
     GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, th);
     nret = th->notify (th->notify_cls, size, &cbuf[ret]);
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Added %u bytes of control message at %u\n", nret, ret);
 #endif
@@ -697,7 +696,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
   }
   /* if there are more pending messages, try to schedule those */
   schedule_transmission (h);
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Transmitting %u bytes to transport service\n", ret);
 #endif
@@ -733,7 +732,7 @@ schedule_transmission_task (void *cls,
     n->th = NULL;
     GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
     n->hn = NULL;
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Signalling timeout for transmission to peer %s due to congestion\n",
                 GNUNET_i2s (&n->id));
@@ -754,7 +753,7 @@ schedule_transmission_task (void *cls,
       return;                   /* no pending messages */
     size = n->th->notify_size + sizeof (struct OutboundMessage);
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling notify_transmit_ready\n");
 #endif
   h->cth =
@@ -792,9 +791,11 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h)
                                             n->th->notify_size);
   else
     return;                     /* no work to be done */
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Scheduling next transmission to service in %llu ms\n",
               (unsigned long long) delay.rel_value);
+#endif
   h->quota_task =
       GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h);
 }
@@ -816,7 +817,7 @@ schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, size_t size,
 {
   struct GNUNET_TRANSPORT_TransmitHandle *th;
 
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Control transmit of %u bytes requested\n", size);
 #endif
@@ -846,13 +847,13 @@ send_start (void *cls, size_t size, void *buf)
   if (buf == NULL)
   {
     /* Can only be shutdown, just give up */
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Shutdown while trying to transmit `%s' request.\n", "START");
 #endif
     return 0;
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START");
 #endif
   GNUNET_assert (size >= sizeof (struct StartMessage));
@@ -884,7 +885,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     /* shutdown, just give up */
     return;
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n");
 #endif
   GNUNET_assert (h->client == NULL);
@@ -931,7 +932,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
     th->notify (th->notify_cls, 0, NULL);
     GNUNET_free (th);
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Scheduling task to reconnect to transport service in %llu ms.\n",
               h->reconnect_delay.rel_value);
@@ -988,7 +989,7 @@ send_set_quota (void *cls, size_t size, void *buf)
     GNUNET_free (sqc);
     return 0;
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Transmitting `%s' request with respect to `%4s'.\n", "SET_QUOTA",
               GNUNET_i2s (&sqc->target));
@@ -1031,7 +1032,7 @@ GNUNET_TRANSPORT_set_quota (struct GNUNET_TRANSPORT_Handle *handle,
     return;
   }
   GNUNET_assert (NULL != handle->client);
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   if (ntohl (quota_out.value__) != n->out_tracker.available_bytes_per_s__)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Quota changed from %u to %u for peer `%s'\n",
@@ -1070,7 +1071,7 @@ send_try_connect (void *cls, size_t size, void *buf)
     GNUNET_free (pid);
     return 0;
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Transmitting `%s' request with respect to `%4s'.\n",
               "REQUEST_CONNECT", GNUNET_i2s (pid));
@@ -1132,7 +1133,7 @@ send_hello (void *cls, size_t size, void *buf)
     GNUNET_free (msg);
     return 0;
   }
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "HELLO");
 #endif
   ssize = ntohs (msg->size);
@@ -1176,7 +1177,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
   }
   msg = GNUNET_malloc (size);
   memcpy (msg, hello, size);
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Offering `%s' message of `%4s' to transport for validation.\n",
               "HELLO", GNUNET_i2s (&peer));
@@ -1279,7 +1280,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
 void
 GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
 {
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n");
 #endif
   /* this disconnects all neighbours... */
@@ -1366,7 +1367,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
   delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size);
   if (delay.rel_value > timeout.rel_value)
     delay.rel_value = 0;        /* notify immediately (with failure) */
-#if DEBUG_TRANSPORT
+#if DEBUG_TRANSPORT_API
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Bandwidth tracker allows next transmission to peer %s in %llu ms\n",
               GNUNET_i2s (target), (unsigned long long) delay.rel_value);