[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13810 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13810 - gnunet/src/dht |
Date: |
Fri, 26 Nov 2010 13:05:13 +0100 |
Author: nevans
Date: 2010-11-26 13:05:13 +0100 (Fri, 26 Nov 2010)
New Revision: 13810
Modified:
gnunet/src/dht/gnunet-service-dht.c
Log:
count number of messages queued vs. number sent out
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-11-26 11:19:56 UTC (rev 13809)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-11-26 12:05:13 UTC (rev 13810)
@@ -257,6 +257,11 @@
struct PeerInfo *prev;
/**
+ * Count of outstanding messages for peer.
+ */
+ unsigned int pending_count;
+
+ /**
* Head of pending messages to be sent to this peer.
*/
struct P2PPendingMessage *head;
@@ -1098,6 +1103,8 @@
#if DEBUG_DHT > 1
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Adding pending message size %d
for peer %s\n", my_short_id, "DHT", msize, GNUNET_i2s(&peer->id));
#endif
+ peer->pending_count++;
+ increment_stats("# pending messages scheduled");
GNUNET_CONTAINER_DLL_insert_after(peer->head, peer->tail, peer->tail,
pending);
if (peer->send_task == GNUNET_SCHEDULER_NO_TASK)
peer->send_task = GNUNET_SCHEDULER_add_now(&try_core_send, peer);
@@ -1144,23 +1151,22 @@
{
off = msize;
memcpy (cbuf, pending->msg, msize);
+ peer->pending_count--;
+ increment_stats("# pending messages sent");
+ GNUNET_assert(peer->pending_count >= 0);
GNUNET_CONTAINER_DLL_remove (peer->head,
peer->tail,
pending);
-#if DEBUG_DHT > 1
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Removing pending message size
%d for peer %s\n", my_short_id, "DHT", msize, GNUNET_i2s(&peer->id));
-#endif
GNUNET_free (pending);
}
#if SMART
while (NULL != pending &&
(size - off >= (msize = ntohs (pending->msg->size))))
{
-#if DEBUG_DHT_ROUTING
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "`%s:%s' : transmit_notify (core)
called with size %d, available %d\n", my_short_id, "dht service", msize, size);
-#endif
memcpy (&cbuf[off], pending->msg, msize);
off += msize;
+ peer->pending_count--;
+ GNUNET_assert(peer->pending_count >= 0);
GNUNET_CONTAINER_DLL_remove (peer->head,
peer->tail,
pending);
@@ -1170,9 +1176,7 @@
#endif
if ((peer->head != NULL) && (peer->send_task == GNUNET_SCHEDULER_NO_TASK))
peer->send_task = GNUNET_SCHEDULER_add_now(&try_core_send, peer);
-#if DEBUG_DHT > 1
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "`%s:%s' : transmit_notify (core) called
with size %d, available %d, returning %d\n", my_short_id, "dht service", msize,
size, off);
-#endif
+
return off;
}
@@ -1701,6 +1705,8 @@
#if DEBUG_DHT > 1
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Adding pending message size %d
for peer %s\n", my_short_id, "DHT", msize, GNUNET_i2s(&peer->id));
#endif
+ peer->pending_count++;
+ increment_stats("# pending messages scheduled");
GNUNET_CONTAINER_DLL_insert_after(peer->head, peer->tail, peer->tail,
pending);
if (peer->send_task == GNUNET_SCHEDULER_NO_TASK)
peer->send_task = GNUNET_SCHEDULER_add_now(&try_core_send, peer);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13810 - gnunet/src/dht,
gnunet <=