gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2516 - GNUnet/src/applications/datastore


From: grothoff
Subject: [GNUnet-SVN] r2516 - GNUnet/src/applications/datastore
Date: Tue, 14 Mar 2006 23:35:06 -0800 (PST)

Author: grothoff
Date: 2006-03-14 23:35:05 -0800 (Tue, 14 Mar 2006)
New Revision: 2516

Modified:
   GNUnet/src/applications/datastore/prefetch.c
Log:
fix

Modified: GNUnet/src/applications/datastore/prefetch.c
===================================================================
--- GNUnet/src/applications/datastore/prefetch.c        2006-03-15 07:28:18 UTC 
(rev 2515)
+++ GNUnet/src/applications/datastore/prefetch.c        2006-03-15 07:35:05 UTC 
(rev 2516)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004 Christian Grothoff (and other contributing 
authors)
+     (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other 
contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -82,13 +82,22 @@
   if (doneSignal != NULL)
     return SYSERR;
   MUTEX_LOCK(&lock);
+  load = 0;
+  while (randomContentBuffer[rCBPos].value != NULL) {
+    rCBPos = (rCBPos + 1) % RCB_SIZE;
+    load++;
+    if (load > RCB_SIZE) {
+      BREAK();
+      MUTEX_UNLOCK(&lock);
+      return SYSERR;
+    }
+  }  
   randomContentBuffer[rCBPos].key = *key;
   randomContentBuffer[rCBPos].value
     = MALLOC(ntohl(value->size));
   memcpy(randomContentBuffer[rCBPos].value,
         value,
         ntohl(value->size));
-  rCBPos = (rCBPos + 1) % RCB_SIZE;
   MUTEX_UNLOCK(&lock);
   load = getCPULoad(); /* FIXME: should use 'IO load' here */
   if (load < 10)





reply via email to

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