gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13703 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r13703 - gnunet/src/core
Date: Tue, 16 Nov 2010 19:43:47 +0100

Author: grothoff
Date: 2010-11-16 19:43:47 +0100 (Tue, 16 Nov 2010)
New Revision: 13703

Modified:
   gnunet/src/core/core_api.c
   gnunet/src/core/gnunet-service-core.c
Log:
fixes and more debug statements

Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c  2010-11-16 17:37:28 UTC (rev 13702)
+++ gnunet/src/core/core_api.c  2010-11-16 18:43:47 UTC (rev 13703)
@@ -473,7 +473,7 @@
     {
       GNUNET_CONTAINER_DLL_remove (h->pending_head,
                                   h->pending_tail,
-                                  cm);
+                                  cm);      
       cm->cont (cm->cont_cls, NULL);
       GNUNET_free (cm);
     }
@@ -574,6 +574,11 @@
                                     h->pending_tail,
                                     h->pending_tail,
                                     cm);
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Adding SEND REQUEST for peer `%s' to message queue\n",
+             GNUNET_i2s (&pr->peer));
+#endif
   trigger_next_request (h, GNUNET_NO);
 }
 
@@ -747,15 +752,33 @@
 
   if ( (GNUNET_YES == h->currently_down) &&
        (ignore_currently_down == GNUNET_NO) )
-    return;
+    {
+#if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Core connection down, not processing queue\n");
+#endif
+      return;
+    }
   if (NULL != h->cth)
-    return;
+    {
+#if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Request pending, not processing queue\n");
+#endif
+      return;
+    }
   if (h->pending_head != NULL)
     msize = ntohs (((struct GNUNET_MessageHeader*) 
&h->pending_head[1])->size);    
   else if (h->ready_peer_head != NULL)
     msize = h->ready_peer_head->pending_head->msize + sizeof (struct 
SendMessage);    
   else
-    return; /* no pending message */
+    {
+#if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Request queue empty, not processing queue\n");
+#endif
+      return; /* no pending message */
+    }
   h->cth = GNUNET_CLIENT_notify_transmit_ready (h->client,
                                                msize,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
@@ -1466,7 +1489,13 @@
          return NULL;
        }
       if (priority <= minp->priority)
-       return NULL; /* priority too low */
+       {
+#if DEBUG_CORE
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                     "Dropping transmission request: priority too low\n");
+#endif
+         return NULL; /* priority too low */
+       }
       GNUNET_CONTAINER_DLL_remove (pr->pending_head,
                                   pr->pending_tail,
                                   minp);
@@ -1502,6 +1531,10 @@
                                     th);
   pr->queue_size++;
   /* was the request queue previously empty? */
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Transmission request added to queue\n");
+#endif
   if (pr->pending_head == th) 
     request_next_transmission (pr);
   return th;
@@ -1525,6 +1558,7 @@
   GNUNET_CONTAINER_DLL_remove (pr->pending_head,
                               pr->pending_tail,
                               th);    
+  pr->queue_size--;
   if (th->cm != NULL)
     {
       /* we're currently in the control queue, remove */
@@ -1658,6 +1692,10 @@
   ret->cont_cls = cont_cls;
   cm->cont = &peer_request_connect_cont;
   cm->cont_cls = ret;
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Queueing REQUEST_CONNECT request\n");
+#endif
   if (h->pending_head == cm)
     trigger_next_request (h, GNUNET_NO);
   return ret;
@@ -1804,11 +1842,17 @@
   rim->reserve_inbound = htonl (amount);
   rim->preference_change = GNUNET_htonll(preference);
   rim->peer = *peer;
+#if DEBUG_CORE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Queueing CHANGE PREFERENCE request\n");
+#endif
   GNUNET_CONTAINER_DLL_insert (h->pending_head,
                               h->pending_tail,
                               cm); 
   pr->pcic = info;
   pr->pcic_cls = info_cls;
+  if (h->pending_head == cm)
+    trigger_next_request (h, GNUNET_NO);
   return irc;
 }
 

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-11-16 17:37:28 UTC (rev 
13702)
+++ gnunet/src/core/gnunet-service-core.c       2010-11-16 18:43:47 UTC (rev 
13703)
@@ -1032,7 +1032,13 @@
       mqe = mqe->next;
     }
   if (queue_size >= MAX_PEER_QUEUE_SIZE)
-    return; /* queue still full */
+    {
+#if DEBUG_CORE_CLIENT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Not considering client transmission requests: queue full\n");
+#endif
+      return; /* queue still full */
+    }
   /* find highest priority request */
   pos = n->active_client_request_head;
   car = NULL;
@@ -1045,6 +1051,11 @@
     }
   if (car == NULL)
     return; /* no pending requests */
+#if DEBUG_CORE_CLIENT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Permitting client transmission request to `%s'\n",
+             GNUNET_i2s (&n->peer));
+#endif
   c = car->client;
   GNUNET_CONTAINER_DLL_remove (n->active_client_request_head,
                               n->active_client_request_tail,
@@ -1084,6 +1095,10 @@
       /* neighbour must have disconnected since request was issued,
         ignore (client will realize it once it processes the 
         disconnect notification) */
+#if DEBUG_CORE_CLIENT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Dropped client request for transmission (am disconnected)\n");
+#endif
       GNUNET_STATISTICS_update (stats, 
                                gettext_noop ("# send requests dropped 
(disconnected)"), 
                                1, 
@@ -1104,6 +1119,10 @@
     }
   if (c->requests == NULL)
     c->requests = GNUNET_CONTAINER_multihashmap_create (16);
+#if DEBUG_CORE_CLIENT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received client transmission request. queueing\n");
+#endif
   car = GNUNET_CONTAINER_multihashmap_get (c->requests,
                                           &req->peer.hashPubKey);
   if (car == NULL)




reply via email to

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