gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6207 - in GNUnet/src/applications: fs/gap fs/lib sqstore_m


From: gnunet
Subject: [GNUnet-SVN] r6207 - in GNUnet/src/applications: fs/gap fs/lib sqstore_mysql sqstore_sqlite
Date: Sat, 9 Feb 2008 15:34:58 -0700 (MST)

Author: grothoff
Date: 2008-02-09 15:34:58 -0700 (Sat, 09 Feb 2008)
New Revision: 6207

Modified:
   GNUnet/src/applications/fs/gap/fs.c
   GNUnet/src/applications/fs/lib/fslibtest.c
   GNUnet/src/applications/sqstore_mysql/mysql.c
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
Log:
fix

Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-02-09 20:11:11 UTC (rev 6206)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-02-09 22:34:58 UTC (rev 6207)
@@ -289,10 +289,10 @@
 #endif
   GNUNET_mutex_lock (GNUNET_FS_lock);
   value->type = htonl(GNUNET_ECRS_BLOCKTYPE_ANY);
-  if ( (1 ==
-       datastore->get (&query, type,
+  ret = datastore->get (&query, type,
                        &GNUNET_FS_HELPER_complete_value_from_database_callback,
-                       value)) &&
+                       value);
+  if ( (0 < ret) &&    
        (value->type != htonl(GNUNET_ECRS_BLOCKTYPE_ANY)) )
     {
       ret = datastore->del (&query, value);
@@ -658,7 +658,6 @@
                                                   &query,
                                                   expiration,
                                                   data_size, dblock);
-  /* FIXME: offer to migration module? */
   if ((sender != NULL) && ((prio > 0) || (!test_load_too_high ())))
     {
       /* consider storing in local datastore */

Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c  2008-02-09 20:11:11 UTC (rev 
6206)
+++ GNUnet/src/applications/fs/lib/fslibtest.c  2008-02-09 22:34:58 UTC (rev 
6207)
@@ -214,7 +214,7 @@
   int ok;
   struct GNUNET_FS_SearchContext *ctx = NULL;
   struct GNUNET_ClientServerConnection *sock;
-  GNUNET_DatastoreValue *block;
+  GNUNET_DatastoreValue *block = NULL;
   GNUNET_DatastoreValue *eblock;
   GNUNET_HashCode hc;
   GNUNET_HashCode query;
@@ -290,6 +290,7 @@
       UNLINK (tmpName);
       GNUNET_free (tmpName);
       GNUNET_free (block);
+      block = NULL;
     }
   fprintf (stderr, "\n");
   for (i = 32; i < GNUNET_MAX_BUFFER_SIZE; i *= 2)
@@ -318,6 +319,7 @@
       CHECK (GNUNET_OK ==
              GNUNET_FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE, &hc));
       GNUNET_free (block);
+      block = NULL;
     }
   fprintf (stderr, "\n");
 
@@ -329,6 +331,7 @@
   block = makeKBlock (60, &hc, &query);
   CHECK (GNUNET_OK == GNUNET_FS_insert (sock, block));
   GNUNET_free (block);
+  block = NULL;
   i = 2;
   mainThread = GNUNET_thread_get_self ();
   ctx = GNUNET_FS_create_search_context (NULL, cfg, lock);
@@ -338,7 +341,8 @@
                          1,
                          &query, 0, 
                          &countCallback, &i);
-  GNUNET_thread_sleep (10 * GNUNET_CRON_SECONDS);
+  if (i > 0)
+    GNUNET_thread_sleep (1 * GNUNET_CRON_SECONDS);
   GNUNET_thread_release_self (mainThread);
   GNUNET_FS_destroy_search_context (ctx);
   CHECK (i <= 0);
@@ -352,6 +356,7 @@
   GNUNET_mutex_destroy (lock);
   GNUNET_cron_stop (cron);
   GNUNET_cron_destroy (cron);
+  GNUNET_free_non_null(block);
 #if START_DAEMON
   GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
 #endif

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2008-02-09 20:11:11 UTC 
(rev 6206)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2008-02-09 22:34:58 UTC 
(rev 6207)
@@ -1147,7 +1147,10 @@
  * @param key maybe NULL (to match all entries)
  * @param type entries of which type are relevant?
  *     Use 0 for any type.
- * @param iter maybe NULL (to just count)
+ * @param iter maybe NULL (to just count); iter
+ *     should return GNUNET_SYSERR to abort the
+ *     iteration, GNUNET_NO to delete the entry and
+ *     continue and GNUNET_OK to continue iterating
  * @return the number of results, GNUNET_SYSERR if the
  *   iter is non-NULL and aborted the iteration
  */

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2008-02-09 20:11:11 UTC 
(rev 6206)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2008-02-09 22:34:58 UTC 
(rev 6207)
@@ -634,7 +634,12 @@
  * call the callback method on it.
  *
  * @param type entries of which type should be considered?
- * @return the number of items stored in the content database
+ * @param iter maybe NULL (to just count); iter
+ *     should return GNUNET_SYSERR to abort the
+ *     iteration, GNUNET_NO to delete the entry and
+ *     continue and GNUNET_OK to continue iterating
+ * @return the number of results processed,
+ *         GNUNET_SYSERR on error
  */
 static int
 sqlite_iterate (unsigned int type,
@@ -848,7 +853,6 @@
               if (ret == GNUNET_SYSERR)
                 {
                   GNUNET_free (datum);
-                  count = GNUNET_SYSERR;
                   break;
                 }
               if (ret == GNUNET_NO)
@@ -877,8 +881,7 @@
  *   type. 0 for all entries.
  * @param iter the callback method
  * @param closure argument to all callback calls
- * @return the number of results, GNUNET_SYSERR if the
- *   iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
  */
 static int
 iterateLowPriority (unsigned int type, GNUNET_DatastoreValueIterator iter,
@@ -896,8 +899,7 @@
  *   type. 0 for all entries.
   * @param iter the callback method
  * @param closure argument to all callback calls
- * @return the number of results, GNUNET_SYSERR if the
- *   iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
  */
 static int
 iterateNonAnonymous (unsigned int type, GNUNET_DatastoreValueIterator iter,
@@ -931,8 +933,7 @@
  * order.
  *
  * @param iter never NULL
- * @return the number of results, GNUNET_SYSERR if the
- *   iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
  */
 static int
 iterateMigrationOrder (GNUNET_DatastoreValueIterator iter, void *closure)
@@ -1003,6 +1004,7 @@
       if (datum == NULL)
         continue;
       newpayload += getContentDatastoreSize (datum);
+      count++;
       if (iter != NULL)
         {
           GNUNET_mutex_unlock (lock);
@@ -1014,7 +1016,6 @@
       if (ret == GNUNET_SYSERR)
         {
           GNUNET_free (datum);
-          count = GNUNET_SYSERR;
           break;
         }
       if (ret == GNUNET_NO)
@@ -1023,7 +1024,6 @@
           delete_by_rowid (handle, rowid);
         }
       GNUNET_free (datum);
-      count++;
     }
   sqlite3_reset (stmt);
   sqlite3_finalize (stmt);
@@ -1102,9 +1102,12 @@
  * @param key maybe NULL (to match all entries)
  * @param type entries of which type are relevant?
  *     Use 0 for any type.
- * @param iter maybe NULL (to just count)
- * @return the number of results, GNUNET_SYSERR if the
- *   iter is non-NULL and aborted the iteration
+ * @param iter maybe NULL (to just count); iter
+ *     should return GNUNET_SYSERR to abort the
+ *     iteration, GNUNET_NO to delete the entry and
+ *     continue and GNUNET_OK to continue iterating
+ * @return the number of results processed,
+ *         GNUNET_SYSERR on error
  */
 static int
 get (const GNUNET_HashCode * key,
@@ -1182,11 +1185,11 @@
               continue;
             }
           GNUNET_mutex_unlock (lock);
+          count++;
           ret = iter (&rkey, datum, closure, rowid);
           GNUNET_mutex_lock (lock);
           if (ret == GNUNET_SYSERR)
             {
-              count = GNUNET_SYSERR;
               GNUNET_free (datum);
               ret = SQLITE_DONE;
               break;
@@ -1197,7 +1200,6 @@
               delete_by_rowid (handle, rowid);
             }
           GNUNET_free (datum);
-          count++;
         }
     }
   sqlite3_reset (stmt);





reply via email to

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