gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2515 - in GNUnet: . src/applications/fs/module src/server


From: grothoff
Subject: [GNUnet-SVN] r2515 - in GNUnet: . src/applications/fs/module src/server
Date: Tue, 14 Mar 2006 23:28:20 -0800 (PST)

Author: grothoff
Date: 2006-03-14 23:28:18 -0800 (Tue, 14 Mar 2006)
New Revision: 2515

Modified:
   GNUnet/ChangeLog
   GNUnet/src/applications/fs/module/migration.c
   GNUnet/src/server/connection.c
Log:
fixing content migration

Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog    2006-03-15 07:28:06 UTC (rev 2514)
+++ GNUnet/ChangeLog    2006-03-15 07:28:18 UTC (rev 2515)
@@ -1,3 +1,8 @@
+Wed Mar 15 00:00:14 PST 2006
+       Fixing various content migration bugs (one that disabled it,
+       one that made it unlikely that migration was even tried, and
+       then various crashes in formerly dead code).
+
 Mon Jan 23 19:04:17 PST 2006
        Added Swedish translation.
 

Modified: GNUnet/src/applications/fs/module/migration.c
===================================================================
--- GNUnet/src/applications/fs/module/migration.c       2006-03-15 07:28:06 UTC 
(rev 2514)
+++ GNUnet/src/applications/fs/module/migration.c       2006-03-15 07:28:18 UTC 
(rev 2515)
@@ -29,7 +29,10 @@
 #include "migration.h"
 #include "fs.h"
 #include "anonymity.h"
+#include "gnunet_stats_service.h"
 
+#define DEBUG_MIGRATION NO
+
 /**
  * Datastore service.
  */
@@ -55,6 +58,10 @@
  */
 static Traffic_ServiceAPI * traffic;
 
+static Stats_ServiceAPI * stats;
+
+static int stat_migration_count;
+
 /**
  * Lock used to access content.
  */
@@ -111,12 +118,22 @@
                                   &content,
                                   0)) {
       MUTEX_UNLOCK(&lock);
+#if DEBUG_MIGRATION
+      LOG(LOG_DEBUG,
+         "Migration: random lookup in datastore failed.\n");
+#endif
       return 0;
     }
   }
   size = sizeof(GapWrapper) + ntohl(content->size) - sizeof(Datastore_Value);
   if (size > padding) {
     MUTEX_UNLOCK(&lock);
+#if DEBUG_MIGRATION
+    LOG(LOG_DEBUG,
+       "Available content of size %u too big for available space (%u)\n",
+       size, 
+       padding);
+#endif
     return 0;
   }
   et = ntohll(content->expirationTime);
@@ -145,12 +162,26 @@
                          position,
                          padding);
     FREE(gw);
+#if DEBUG_MIGRATION
+    LOG(LOG_DEBUG,
+       "gap's tryMigrate returned %u\n",
+       ret);
+#endif
+
+  } else {
+#if DEBUG_MIGRATION
+    LOG(LOG_DEBUG,
+       "Migration: anonymity requirements not satisfied.\n");
+#endif
   }
   if (ret > 0) {
     FREE(content);
     content = NULL;
   }
   MUTEX_UNLOCK(&lock);
+  if (ret > 0)
+    stats->change(stat_migration_count, 1);
+
   return ret;
 }
 
@@ -167,11 +198,19 @@
   traffic = t;
   coreAPI->registerSendCallback(512,
                                &activeMigrationCallback);
+  stats = capi->requestService("stats");
+  if (stats != NULL) 
+    stat_migration_count = stats->create(gettext_noop("# blocks migrated"));
+
 }
 
 void doneMigration() {
   coreAPI->unregisterSendCallback(512,
                                  &activeMigrationCallback);
+  if (stats != NULL) {
+    coreAPI->releaseService(stats);
+    stats = NULL;
+  }
   datastore = NULL;
   gap = NULL;
   dht = NULL;

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2006-03-15 07:28:06 UTC (rev 2514)
+++ GNUnet/src/server/connection.c      2006-03-15 07:28:18 UTC (rev 2515)
@@ -2246,6 +2246,34 @@
          /* the host may still be worth trying again soon: */
          identity->whitelistHost(&root->session.sender);
        }
+       if ( (root->available_send_window >= 60000) &&
+            (root->sendBufferSize < 4) &&
+            (scl_nextHead != NULL) &&
+            (getNetworkLoadUp() < 25) &&
+            (getCPULoad() < 50) ) {
+         /* create some traffic by force! */
+         char * msgBuf;
+         unsigned int mSize;
+         SendCallbackList * pos;
+
+         msgBuf = MALLOC(60000);
+         pos = scl_nextHead;
+         while (pos != NULL) {
+           if (pos->minimumPadding + mSize <= 60000) {
+             mSize = pos->callback(&root->session.sender,
+                                   msgBuf,
+                                   60000);
+             if (mSize > 0)
+               unicast(&root->session.sender,
+                       (P2P_MESSAGE_HEADER*) msgBuf,
+                       0,
+                       5 * cronMINUTES);
+           }       
+           pos = pos->next;
+         }
+         FREE(msgBuf);
+       }
+
        break;
       default: /* not up, not down - partial SETKEY exchange */
        if ( (now > root->isAlive) &&





reply via email to

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