gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11580 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r11580 - gnunet/src/util
Date: Tue, 1 Jun 2010 00:01:42 +0200

Author: grothoff
Date: 2010-06-01 00:01:42 +0200 (Tue, 01 Jun 2010)
New Revision: 11580

Modified:
   gnunet/src/util/server_nc.c
Log:
fixing bug with queue management in server nc -- and some additional debug 
messages

Modified: gnunet/src/util/server_nc.c
===================================================================
--- gnunet/src/util/server_nc.c 2010-05-31 19:32:25 UTC (rev 11579)
+++ gnunet/src/util/server_nc.c 2010-05-31 22:01:42 UTC (rev 11580)
@@ -33,6 +33,8 @@
 #include "gnunet_time_lib.h"
 
 
+#define DEBUG_SERVER_NC GNUNET_NO
+
 /**
  * Entry in list of messages pending to be transmitted.
  */
@@ -289,12 +291,18 @@
   while (cl->pending_head != NULL)
     {
       pml = cl->pending_head;
+      msize = ntohs (pml->msg->size);
+      if (size < msize)
+       break;
       cl->pending_head = pml->next;
       if (pml->next == NULL)
        cl->pending_tail = NULL;
-      msize = ntohs (pml->msg->size);
-      if (size < msize)
-       break;
+#if DEBUG_SERVER_NC
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Copying message of type %u and size %u from pending queue to 
transmission buffer\n",
+                 ntohs (pml->msg->type),
+                 msize);
+#endif
       memcpy (&cbuf[ret], pml->msg, msize);
       ret += msize;
       size -= msize;
@@ -330,7 +338,14 @@
 
   if ( (client->num_pending > nc->queue_length) &&
        (GNUNET_YES == can_drop) )
-    return; /* drop! */
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                 "Dropping message of type %u and size %u due to full queue 
(%u entries)\n",
+                 ntohs (msg->type),
+                 ntohs (msg->size),
+                 (unsigned int) nc->queue_length);
+      return; /* drop! */
+    }
   if (client->num_pending > nc->queue_length)
     {
       /* FIXME: consider checking for other messages in the
@@ -340,7 +355,14 @@
   size = ntohs (msg->size);
   pml = GNUNET_malloc (sizeof (struct PendingMessageList) + size);
   pml->msg = (const struct GNUNET_MessageHeader*) &pml[1];
-  pml->can_drop = can_drop;
+  pml->can_drop = can_drop; 
+#if DEBUG_SERVER_NC
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Adding message of type %u and size %u to pending queue (which 
has %u entries)\n",
+             ntohs (msg->type),
+             ntohs (msg->size),
+             (unsigned int) nc->queue_length);
+#endif
   memcpy (&pml[1], msg, size);
   /* append */
   if (client->pending_tail != NULL)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]