gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11583 - gnunet/src/core
Date: Tue, 1 Jun 2010 00:04:27 +0200

Author: grothoff
Date: 2010-06-01 00:04:27 +0200 (Tue, 01 Jun 2010)
New Revision: 11583

Modified:
   gnunet/src/core/gnunet-service-core.c
Log:
use larger queue, proper handling of messages with short transmission time, 
more logging

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-05-31 22:03:09 UTC (rev 
11582)
+++ gnunet/src/core/gnunet-service-core.c       2010-05-31 22:04:27 UTC (rev 
11583)
@@ -58,7 +58,7 @@
  * notifications to a client?  (this can cause notifications
  * about outgoing messages to be dropped).
  */
-#define MAX_NOTIFY_QUEUE 16
+#define MAX_NOTIFY_QUEUE 1024
 
 /**
  * Minimum bandwidth (out) to assign to any connected peer.
@@ -142,15 +142,7 @@
  */
 #define MAX_MESSAGE_AGE GNUNET_TIME_UNIT_DAYS
 
-/**
- * What is the maximum size for encrypted messages?  Note that this
- * number imposes a clear limit on the maximum size of any message.
- * Set to a value close to 64k but not so close that transports will
- * have trouble with their headers.
- */
-#define MAX_ENCRYPTED_MESSAGE_SIZE (63 * 1024)
 
-
 /**
  * State machine for our P2P encryption handshake.  Everyone starts in
  * "DOWN", if we receive the other peer's key (other peer initiated)
@@ -794,7 +786,8 @@
 {
 #if DEBUG_CORE_CLIENT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Preparing to send message of type %u to client.\n",
+              "Preparing to send %u bytes of message of type %u to client.\n",
+             (unsigned int) ntohs (msg->size),
               (unsigned int) ntohs (msg->type));
 #endif  
   GNUNET_SERVER_notification_context_unicast (notifier,
@@ -1561,7 +1554,7 @@
       off = 0;
       /* maximum time we can wait before transmitting anything
          and still make all of our deadlines */
-      slack = GNUNET_CONSTANTS_MAX_CORK_DELAY;
+      slack = GNUNET_TIME_UNIT_FOREVER_REL;
       pos = n->messages;
       /* note that we use "*2" here because we want to look
          a bit further into the future; much more makes no
@@ -1641,7 +1634,7 @@
     }
   /* guard against sending "tiny" messages with large headers without
      urgent deadlines */
-  if ( (slack.value > 0) && 
+  if ( (slack.value > GNUNET_CONSTANTS_MAX_CORK_DELAY.value) && 
        (size > 4 * off) &&
        (queue_size <= MAX_PEER_QUEUE_SIZE - 2) )
     {
@@ -1659,7 +1652,7 @@
 #if DEBUG_CORE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "Deferring transmission for %llums due to underfull message 
buffer size (%u/%u)\n",
-                 (unsigned long long) slack.value,
+                 (unsigned long long) retry_time->value,
                  (unsigned int) off,
                  (unsigned int) size);
 #endif
@@ -1675,9 +1668,22 @@
           pos->do_transmit = GNUNET_YES;        /* mark for transmission */
           off += pos->size;
           size -= pos->size;
+#if DEBUG_CORE
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                     "Selecting message of size %u for transmission\n",
+                     (unsigned int) pos->size);
+#endif
         }
       else
-        pos->do_transmit = GNUNET_NO;   /* mark for not transmitting! */
+       {
+#if DEBUG_CORE
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                     "Not selecting message of size %u for transmission at 
this time (maximum is %u)\n",
+                     (unsigned int) pos->size,
+                     size);
+#endif
+         pos->do_transmit = GNUNET_NO;   /* mark for not transmitting! */
+       }
       pos = pos->next;
     }
 #if DEBUG_CORE
@@ -1735,7 +1741,6 @@
   ntm->distance = htonl (n->last_distance);
   ntm->latency = GNUNET_TIME_relative_hton (n->last_latency);
   ntm->peer = n->peer;
-  
   pos = n->messages;
   prev = NULL;
   while ((pos != NULL) && (size >= sizeof (struct GNUNET_MessageHeader)))
@@ -1772,8 +1777,10 @@
                               GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND);   
 #if DEBUG_HANDSHAKE
          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                     "Encrypting message of type %u\n",
-                     (unsigned int) ntohs(((struct 
GNUNET_MessageHeader*)&pos[1])->type));
+                     "Encrypting %u bytes with message of type %u and size 
%u\n",
+                     pos->size,
+                     (unsigned int) ntohs(((const struct 
GNUNET_MessageHeader*)&pos[1])->type),
+                     (unsigned int) ntohs(((const struct 
GNUNET_MessageHeader*)&pos[1])->size));
 #endif
          /* copy for encrypted transmission */
           memcpy (&buf[ret], &pos[1], pos->size);
@@ -1905,7 +1912,7 @@
 static void
 process_plaintext_neighbour_queue (struct Neighbour *n)
 {
-  char pbuf[MAX_ENCRYPTED_MESSAGE_SIZE];        /* plaintext */
+  char pbuf[GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE + sizeof (struct 
EncryptedMessage)];        /* plaintext */
   size_t used;
   size_t esize;
   struct EncryptedMessage *em;  /* encrypted message */
@@ -1985,7 +1992,7 @@
   used = sizeof (struct EncryptedMessage);
   used += batch_message (n,
                          &pbuf[used],
-                         MAX_ENCRYPTED_MESSAGE_SIZE - used,
+                         GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE,
                          &deadline, &retry_time, &priority);
   if (used == sizeof (struct EncryptedMessage))
     {
@@ -3258,7 +3265,7 @@
   int need_align;
 
   while (offset + sizeof (struct GNUNET_MessageHeader) <= buffer_size)
-    {
+    {     
       if (0 != offset % sizeof (uint16_t))
         {
           /* outch, need to copy to access header */
@@ -3283,6 +3290,14 @@
 #else
       need_align = (0 != offset % 8) ? GNUNET_YES : GNUNET_NO;
 #endif
+#if DEBUG_CORE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Delivering %u bytes of message at offset %u/%u to 
clients.\n",
+                 (unsigned int) msize,
+                 (unsigned int) offset,
+                 (unsigned int) buffer_size);
+#endif
+
       if (GNUNET_YES == need_align)
         align_and_deliver (sender, &buffer[offset], msize);
       else




reply via email to

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