gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2749 - in GNUnet/src/applications: fs/module gap


From: grothoff
Subject: [GNUnet-SVN] r2749 - in GNUnet/src/applications: fs/module gap
Date: Fri, 5 May 2006 17:07:47 -0700 (PDT)

Author: grothoff
Date: 2006-05-05 17:07:45 -0700 (Fri, 05 May 2006)
New Revision: 2749

Modified:
   GNUnet/src/applications/fs/module/migration.c
   GNUnet/src/applications/gap/gap.c
Log:
trying to fix 1025

Modified: GNUnet/src/applications/fs/module/migration.c
===================================================================
--- GNUnet/src/applications/fs/module/migration.c       2006-05-05 23:58:06 UTC 
(rev 2748)
+++ GNUnet/src/applications/fs/module/migration.c       2006-05-06 00:07:45 UTC 
(rev 2749)
@@ -64,6 +64,8 @@
 
 static int stat_migration_count;
 
+static int stat_on_demand_migration_attempts;
+
 /**
  * Lock used to access content.
  */
@@ -137,6 +139,9 @@
       MUTEX_UNLOCK(&lock);
       return 0;
     }
+    if (stats != NULL)
+      stats->change(stat_on_demand_migration_attempts, 1); 
+
     FREE(content);
     content = enc;
   }
@@ -215,8 +220,10 @@
   coreAPI->registerSendCallback(512,
                                &activeMigrationCallback);
   stats = capi->requestService("stats");
-  if (stats != NULL) 
+  if (stats != NULL) {
     stat_migration_count = stats->create(gettext_noop("# blocks migrated"));
+    stat_on_demand_migration_attempts = stats->create(gettext_noop("# 
on-demand block migration attempts"));
+  }
 
 }
 

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2006-05-05 23:58:06 UTC (rev 2748)
+++ GNUnet/src/applications/gap/gap.c   2006-05-06 00:07:45 UTC (rev 2749)
@@ -1863,10 +1863,8 @@
   unsigned int size;
 
   size = sizeof(P2P_gap_reply_MESSAGE) + ntohl(data->size) - 
sizeof(DataContainer);
-  if (size > padding)
+  if ( (size > padding) || (size >= MAX_BUFFER_SIZE) )
     return 0;
-  if (size >= MAX_BUFFER_SIZE)
-    return 0;
   reply = (P2P_gap_reply_MESSAGE*) position;
   reply->header.type
     = htons(P2P_PROTO_gap_RESULT);
@@ -1877,6 +1875,13 @@
   memcpy(&reply[1],
         &data[1],
         size - sizeof(P2P_gap_reply_MESSAGE));
+#if EXTRA_CHECKS
+  /* verify content integrity */
+  GNUNET_ASSERT(SYSERR != bs->put(bs->closure,
+                                 primaryKey,
+                                 data,
+                                 0));
+#endif
   return size;
 }
 





reply via email to

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