*/
#define STARTING_NEIGHBOURS_SIZE 16
-
/**
* Handle for a message that should be transmitted to the service.
* Used for both control messages and normal messages.
{
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
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
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));
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
}
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
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");
}
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 <
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));
{
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
}
/* 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
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));
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 =
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);
}
{
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
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));
/* 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);
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);
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));
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",
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));
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);
}
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));
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... */
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);