[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15417 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15417 - gnunet/src/transport |
Date: |
Sun, 5 Jun 2011 00:29:07 +0200 |
Author: grothoff
Date: 2011-06-05 00:29:07 +0200 (Sun, 05 Jun 2011)
New Revision: 15417
Modified:
gnunet/src/transport/transport_api_new.c
Log:
fixes
Modified: gnunet/src/transport/transport_api_new.c
===================================================================
--- gnunet/src/transport/transport_api_new.c 2011-06-04 16:33:01 UTC (rev
15416)
+++ gnunet/src/transport/transport_api_new.c 2011-06-04 22:29:07 UTC (rev
15417)
@@ -662,13 +662,12 @@
/* then, if possible and no control messages pending, send data messages */
while ( (NULL == h->control_head) &&
- (NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) )
+ (NULL != (n = GNUNET_CONTAINER_heap_remove_root (h->ready_heap))) )
{
+ n->hn = NULL;
if (GNUNET_YES != n->is_ready)
{
/* peer not ready, wait for notification! */
- GNUNET_CONTAINER_heap_remove_node (n->hn);
- n->hn = NULL;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == n->th->timeout_task);
n->th->timeout_task = GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_absolute_get_remaining (n->th->timeout),
&timeout_request_due_to_congestion,
@@ -738,6 +737,11 @@
n->th = NULL;
GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
n->hn = NULL;
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Signalling timeout for transmission to peer %s due to
congestion\n",
+ GNUNET_i2s (&n->id));
+#endif
GNUNET_assert (0 ==
th->notify (th->notify_cls, 0, NULL));
GNUNET_free (th);
@@ -790,10 +794,13 @@
}
if (NULL != h->control_head)
delay = GNUNET_TIME_UNIT_ZERO;
- else if (NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap)))
- delay = GNUNET_TIME_absolute_get_remaining (n->th->timeout);
+ else if (NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap)))
+ delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker,
n->th->notify_size);
else
return; /* no work to be done */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Scheduling next transmission to service in %llu ms\n",
+ (unsigned long long) delay.rel_value);
h->quota_task = GNUNET_SCHEDULER_add_delayed (delay,
&schedule_transmission_task,
h);
@@ -826,9 +833,9 @@
th->notify = notify;
th->notify_cls = notify_cls;
th->notify_size = size;
- GNUNET_CONTAINER_DLL_insert (h->control_head,
- h->control_tail,
- th);
+ GNUNET_CONTAINER_DLL_insert_tail (h->control_head,
+ h->control_tail,
+ th);
schedule_transmission (h);
}
@@ -867,6 +874,8 @@
s.do_check = htonl (h->check_self);
s.self = h->self;
memcpy (buf, &s, sizeof (struct StartMessage));
+ GNUNET_CLIENT_receive (h->client,
+ &demultiplexer, h, GNUNET_TIME_UNIT_FOREVER_REL);
return sizeof (struct StartMessage);
}
@@ -901,8 +910,6 @@
schedule_control_transmit (h,
sizeof (struct StartMessage),
&send_start, h);
- GNUNET_CLIENT_receive (h->client,
- &demultiplexer, h, GNUNET_TIME_UNIT_FOREVER_REL);
}
@@ -921,7 +928,7 @@
/* Forget about all neighbours that we used to be connected to */
GNUNET_CONTAINER_multihashmap_iterate(h->neighbours,
&neighbour_delete,
- NULL);
+ h);
if (NULL != h->cth)
{
GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
@@ -1037,7 +1044,7 @@
{
struct Neighbour *n;
struct SetQuotaContext *sqc;
-
+
n = neighbour_find (handle, target);
if (NULL == n)
{
@@ -1047,6 +1054,7 @@
GNUNET_i2s (target));
return;
}
+ GNUNET_assert (NULL != handle->client);
#if DEBUG_TRANSPORT
if (ntohl (quota_out.value__) != n->out_tracker.available_bytes_per_s__)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1094,7 +1102,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting `%s' request with respect to `%4s'.\n",
"REQUEST_CONNECT",
- GNUNET_i2s (&sqc->target));
+ GNUNET_i2s (pid));
#endif
GNUNET_assert (size >= sizeof (struct TransportRequestConnectMessage));
msg.header.size = htons (sizeof (struct TransportRequestConnectMessage));
@@ -1120,6 +1128,8 @@
{
struct GNUNET_PeerIdentity *pid;
+ if (NULL == handle->client)
+ return;
pid = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
*pid = *target;
schedule_control_transmit (handle,
@@ -1406,6 +1416,12 @@
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
+ 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);
+#endif
n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap,
n,
delay.rel_value);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15417 - gnunet/src/transport,
gnunet <=