gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3618 - in GNUnet: . src/applications/datastore src/applica


From: grothoff
Subject: [GNUnet-SVN] r3618 - in GNUnet: . src/applications/datastore src/applications/fs/fsui src/applications/fs/module src/applications/fs/tools src/applications/sqstore_sqlite src/include src/server src/util/config_impl src/util/os
Date: Fri, 3 Nov 2006 05:44:00 -0800 (PST)

Author: grothoff
Date: 2006-11-03 05:43:50 -0800 (Fri, 03 Nov 2006)
New Revision: 3618

Modified:
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/datastore/filter.c
   GNUnet/src/applications/fs/fsui/upload.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/fs/tools/gnunet-insert.c
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
   GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
   GNUnet/src/include/gnunet_util_getopt.h
   GNUnet/src/server/connection.c
   GNUnet/src/server/gnunet-update.c
   GNUnet/src/server/startup.c
   GNUnet/src/util/config_impl/impl.c
   GNUnet/src/util/os/dso.c
   GNUnet/src/util/os/statuscalls.c
   GNUnet/todo
Log:
fixing sqlstore bugs, fixing quota violations, fixing gnunet-insert bugs

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2006-11-02 22:29:29 UTC 
(rev 3617)
+++ GNUnet/src/applications/datastore/datastore.c       2006-11-03 13:43:50 UTC 
(rev 3618)
@@ -39,11 +39,6 @@
 #define DEBUG_DATASTORE NO
 
 /**
- * Require 1 MB 'free' space.
- */
-#define MIN_FREE 1024 * 1024
-
-/**
  * SQ-store handle
  */
 static SQstore_ServiceAPI * sq;
@@ -69,7 +64,10 @@
 static unsigned long long quota;
 
 /**
+ * Require 1/10th of quota to be 'free' space.
  */
+#define MIN_FREE (quota / 10)
+
 static unsigned long long getSize() {
   return sq->getSize();
 }
@@ -78,7 +76,6 @@
   return testAvailable(query);
 }
 
-
 static int get(const HashCode512 * query,
               unsigned int type,
               Datum_Iterator iter,
@@ -87,12 +84,14 @@
 #if DEBUG_DATASTORE
     EncName enc;
 
-    IF_GELOG(coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-         hash2enc(query,
-                  &enc));
-    GE_LOG(coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       "Datastore availability pre-test failed for `%s'.\n",
-       &enc);
+    IF_GELOG(coreAPI->ectx, 
+            GE_DEBUG | GE_REQUEST | GE_USER,
+            hash2enc(query,
+                     &enc));
+    GE_LOG(coreAPI->ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          "Datastore availability pre-test failed for `%s'.\n",
+          &enc);
 #endif
     return 0;
   }
@@ -109,39 +108,42 @@
               const Datastore_Value * value) {
   int ok;
   EncName enc;
-  int i;
 
   if (! testAvailable(query)) {
-    IF_GELOG(coreAPI->ectx, GE_WARNING | GE_BULK | GE_USER,
-         hash2enc(query,
-                  &enc));
-    GE_LOG(coreAPI->ectx, GE_WARNING | GE_BULK | GE_USER,
-       _("Availability test failed for `%s' at %s:%d.\n"),
-       &enc,
-       __FILE__, __LINE__);
+    IF_GELOG(coreAPI->ectx,
+            GE_WARNING | GE_BULK | GE_USER,
+            hash2enc(query,
+                     &enc));
+    GE_LOG(coreAPI->ectx, 
+          GE_WARNING | GE_BULK | GE_USER,
+          _("Availability test failed for `%s' at %s:%d.\n"),
+          &enc,
+          __FILE__, __LINE__);
     return 0;
   }
   ok = sq->del(query, value);
-  if (0 < ok) {
-    for (i=0;i<ok;i++) {
-      makeUnavailable(query); /* update filter! */
-      available += ntohl(value->size);
-    }
+  if (ok >= 0) {
+    makeUnavailable(query); /* update filter! */
+    available += ntohl(value->size);
 #if DEBUG_DATASTORE
-    IF_GELOG(coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-         hash2enc(query,
-                  &enc));
-    GE_LOG(coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       "Deleted `%s' from database.\n",
-       &enc);
+    IF_GELOG(coreAPI->ectx, 
+            GE_DEBUG | GE_REQUEST | GE_USER,
+            hash2enc(query,
+                     &enc));
+    GE_LOG(coreAPI->ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          "Deleted `%s' from database.\n",
+          &enc);
 #endif
   } else {
-    IF_GELOG(coreAPI->ectx, GE_WARNING | GE_BULK | GE_USER,
-         hash2enc(query,
-                  &enc));
-    GE_LOG(coreAPI->ectx, GE_WARNING | GE_BULK | GE_USER,
-       _("Database failed to delete `%s'.\n"),
-       &enc);
+    IF_GELOG(coreAPI->ectx, 
+            GE_WARNING | GE_BULK | GE_USER,
+            hash2enc(query,
+                     &enc));
+    GE_LOG(coreAPI->ectx,
+          GE_WARNING | GE_BULK | GE_USER,
+          _("Database failed to delete `%s'.\n"),
+          &enc);
   }
   return ok;
 }
@@ -162,10 +164,11 @@
   /* check if we have enough space / priority */
   if ( (available < ntohl(value->size) ) &&
        (minPriority > ntohl(value->prio)) ) {
-    GE_LOG(coreAPI->ectx, GE_WARNING | GE_BULK | GE_USER,
-       "Datastore full (%llu/%llu) and content priority too low to kick out 
other content.  Refusing put.\n",
-       sq->getSize(),
-       quota);
+    GE_LOG(coreAPI->ectx,
+          GE_WARNING | GE_BULK | GE_USER,
+          "Datastore full (%llu/%llu) and content priority too low to kick out 
other content.  Refusing put.\n",
+          sq->getSize(),
+          quota);
     return SYSERR; /* new content has such a low priority that
                      we should not even bother! */
   }
@@ -248,11 +251,12 @@
     return OK;
   }
 #if DEBUG_DATASTORE
-  GE_LOG(coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Migration: available %llu (need %u), min priority %u have %u\n",
-      available, ntohl(value->size),
-      minPriority,
-      ntohl(value->prio));
+  GE_LOG(coreAPI->ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Migration: available %llu (need %u), min priority %u have %u\n",
+        available, ntohl(value->size),
+        minPriority,
+        ntohl(value->prio));
 #endif
   /* check if we have enough space / priority */
   if ( (available < ntohl(value->size) ) &&
@@ -273,16 +277,17 @@
 }
 
 static int freeSpaceExpired(const HashCode512 * key,
-                        const Datastore_Value * value,
-                        void * closure) {
+                           const Datastore_Value * value,
+                           void * closure) {
   int ret;
 
   if (get_time() < ntohll(value->expirationTime))
     return SYSERR; /* not expired */
   ret = sq->del(key, value);
-  if (ret != SYSERR)
-    available += ret * ntohl(value->size);
-  if (available >= MIN_FREE)
+  if (ret != SYSERR) 
+    available += ntohl(value->size);
+  if ( (available > 0) &&
+       (available >= MIN_FREE) ) 
     return SYSERR;
   return OK;
 }
@@ -294,9 +299,10 @@
 
   minPriority = ntohl(value->prio);
   ret = sq->del(key, value);
-  if (ret != SYSERR)
-    available += ret * ntohl(value->size);
-  if (available >= MIN_FREE)
+  if (ret != SYSERR) 
+    available +=  ntohl(value->size);
+  if ( (available > 0) &&
+       (available >= MIN_FREE) )
     return SYSERR;
   return OK;
 }
@@ -309,11 +315,13 @@
  */
 static void cronMaintenance(void * unused) {
   available = quota - sq->getSize();
-  if (available < MIN_FREE) {
+  if ( (available < 0) ||
+       (available < MIN_FREE) ) {
     sq->iterateExpirationTime(ANY_BLOCK,
                              &freeSpaceExpired,
                              NULL);
-    if (available < MIN_FREE) {
+    if ( (available < 0) ||
+        (available < MIN_FREE) ) {
       sq->iterateLowPriority(ANY_BLOCK,
                             &freeSpaceLow,
                             NULL);
@@ -337,7 +345,7 @@
                                              "FS",
                                              "QUOTA",
                                              0,
-                                             ((unsigned long long)-1)/1024,
+                                             ((unsigned long 
long)-1)/1024/1024,
                                              1024,
                                              &lquota)) {
     GE_BREAK(capi->ectx, 0);
@@ -345,7 +353,7 @@
   }
 
   quota
-    = lquota * 1024L * 1024L; /* MB to bytes */
+    = lquota * 1024 * 1024; /* MB to bytes */
   state = capi->requestService("state");
   if (state != NULL) {
     sqot = htonl(lquota);
@@ -365,7 +373,6 @@
     return NULL;
   }
   coreAPI = capi;
-
   initPrefetch(capi->ectx,
               capi->cfg,
               sq);
@@ -376,7 +383,7 @@
     capi->releaseService(sq);
     return NULL;
   }
-  cronMaintenance(NULL);
+  available = quota - sq->getSize();
   cron_add_job(capi->cron,
               &cronMaintenance,
               10 * cronSECONDS,
@@ -434,7 +441,7 @@
                                              "FS",
                                              "QUOTA",
                                              0,
-                                             ((unsigned long long)-1)/1024,
+                                             ((unsigned long 
long)-1)/1024/1024,
                                              1024,
                                              &quota))
     return; /* OOPS */

Modified: GNUnet/src/applications/datastore/filter.c
===================================================================
--- GNUnet/src/applications/datastore/filter.c  2006-11-02 22:29:29 UTC (rev 
3617)
+++ GNUnet/src/applications/datastore/filter.c  2006-11-03 13:43:50 UTC (rev 
3618)
@@ -70,7 +70,7 @@
                                              "FS",
                                              "QUOTA",
                                              0,
-                                             ((unsigned long long)-1)/1024,
+                                             ((unsigned long 
long)-1)/1024/1024,
                                              1024,
                                              &quota))
     return SYSERR;

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2006-11-02 22:29:29 UTC (rev 
3617)
+++ GNUnet/src/applications/fs/fsui/upload.c    2006-11-03 13:43:50 UTC (rev 
3618)
@@ -523,6 +523,7 @@
   struct FSUI_UploadShared * shared;
   struct FSUI_UploadList * ul;
 
+  config = NULL;
   if (doExtract) {
     extractors = EXTRACTOR_loadDefaultLibraries();
     if ( (0 == GC_get_configuration_value_string(ctx->cfg,
@@ -536,7 +537,6 @@
     }
   } else {
     extractors = NULL;
-    config = NULL;
   }
   shared = MALLOC(sizeof(FSUI_UploadShared));
   shared->dsc = dsc;
@@ -566,6 +566,7 @@
     freeShared(shared);
     return NULL;
   }
+  GE_ASSERT(ctx->ectx, ul->shared == shared);
   return ul;
 }
 

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2006-11-02 22:29:29 UTC (rev 
3617)
+++ GNUnet/src/applications/fs/module/fs.c      2006-11-03 13:43:50 UTC (rev 
3618)
@@ -41,7 +41,7 @@
 #include "querymanager.h"
 #include "fs.h"
 
-#define DEBUG_FS NO
+#define DEBUG_FS YES
 
 typedef struct {
   struct DHT_GET_RECORD * rec;
@@ -189,12 +189,14 @@
   }
   processResponse(query, dv);
 #if DEBUG_FS
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(query,
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received GAP-PUT request (query: `%s')\n",
-      &enc);
+  IF_GELOG(ectx, 
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(query,
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received GAP-PUT request (query: `%s')\n",
+        &enc);
 #endif
   if (migration)
     ret = datastore->putUpdate(query,
@@ -211,12 +213,14 @@
 #if DEBUG_FS
   EncName enc;
 
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(query,
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Found reply to query `%s'.\n",
-      &enc);
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(query,
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Found reply to query `%s'.\n",
+        &enc);
 #endif
   gapPut(NULL,
         query,
@@ -253,12 +257,14 @@
   }
   rs = (CS_fs_request_search_MESSAGE*) req;
 #if DEBUG_FS
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(&rs->query[0],
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received QUERY STOP (query: `%s')\n",
-      &enc);
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(&rs->query[0],
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received QUERY STOP (query: `%s')\n",
+        &enc);
 #endif
   if (ntohl(rs->anonymityLevel) == 0) {
     /* FIXME 0.7.1: cancel with dht? */
@@ -309,14 +315,16 @@
   type = getTypeOfBlock(ntohs(ri->header.size) - 
sizeof(CS_fs_request_insert_MESSAGE),
                        (const DBlock*) &ri[1]);
 #if DEBUG_FS
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(&query,
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received REQUEST INSERT (query: `%s', type: %u, priority %u)\n",
-      &enc,
-      type,
-      ntohl(ri->prio));
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(&query,
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received REQUEST INSERT (query: `%s', type: %u, priority %u)\n",
+        &enc,
+        type,
+        ntohl(ri->prio));
 #endif
   datum->type = htonl(type);
   memcpy(&datum[1],
@@ -395,13 +403,14 @@
   fn[fnLen] = 0;
 
   ret = ONDEMAND_initIndex(&ri->fileId,
-          fn);
+                          fn);
 
   FREE(fn);
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Sending confirmation (%s) of index initialization request to client\n",
-      ret == OK ? "success" : "failure");
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Sending confirmation (%s) of index initialization request to 
client\n",
+        ret == OK ? "success" : "failure");
 #endif
   return coreAPI->sendValueToClient(sock,
             ret);
@@ -431,9 +440,10 @@
                       ntohs(ri->header.size) - 
sizeof(CS_fs_request_index_MESSAGE),
                       (const DBlock*) &ri[1]);
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Sending confirmation (%s) of index request to client\n",
-      ret == OK ? "success" : "failure");
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Sending confirmation (%s) of index request to client\n",
+        ret == OK ? "success" : "failure");
 #endif
   return coreAPI->sendValueToClient(sock,
                                    ret);
@@ -455,19 +465,21 @@
                    &comp[1],
                    ntohl(value->size) - sizeof(Datastore_Value))) ) {
 #if DEBUG_FS
-    GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       "`%s' found value that does not match (%u, %u).\n",
-       __FUNCTION__,
-       ntohl(comp->size),
-       ntohl(value->size));
+    GE_LOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          "`%s' found value that does not match (%u, %u).\n",
+          __FUNCTION__,
+          ntohl(comp->size),
+          ntohl(value->size));
 #endif
     return OK;
   }
   *comp = *value; /* make copy! */
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "`%s' found value that matches.\n",
-      __FUNCTION__);
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "`%s' found value that matches.\n",
+        __FUNCTION__);
 #endif
   return SYSERR;
 }
@@ -512,13 +524,15 @@
     return SYSERR;
   }
 #if DEBUG_FS
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(&query,
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received REQUEST DELETE (query: `%s', type: %u)\n",
-      &enc,
-      type);
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(&query,
+                   &enc));
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received REQUEST DELETE (query: `%s', type: %u)\n",
+        &enc,
+        type);
 #endif
   MUTEX_LOCK(lock);
   if (SYSERR == datastore->get(&query,
@@ -532,9 +546,10 @@
   MUTEX_UNLOCK(lock);
   FREE(value);
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Sending confirmation (%s) of delete request to client\n",
-      ret != SYSERR ? "success" : "failure");
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Sending confirmation (%s) of delete request to client\n",
+        ret != SYSERR ? "success" : "failure");
 #endif
   return coreAPI->sendValueToClient(sock,
                                    ret);
@@ -554,8 +569,9 @@
   }
   ru = (CS_fs_request_unindex_MESSAGE*) req;
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received REQUEST UNINDEX\n");
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received REQUEST UNINDEX\n");
 #endif
   ret = ONDEMAND_unindex(datastore,
                         ntohl(ru->blocksize),
@@ -579,8 +595,9 @@
   }
   ru = (RequestTestindex*) req;
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received REQUEST TESTINDEXED\n");
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received REQUEST TESTINDEXED\n");
 #endif
   ret = ONDEMAND_testindexed(datastore,
                             &ru->fileId);
@@ -595,8 +612,9 @@
 static int csHandleRequestGetAvgPriority(struct ClientHandle * sock,
                                         const MESSAGE_HEADER * req) {
 #if DEBUG_FS
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received REQUEST GETAVGPRIORITY\n");
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received REQUEST GETAVGPRIORITY\n");
 #endif
   return coreAPI->sendValueToClient(sock,
                                    gap->getAvgPriority());
@@ -633,12 +651,14 @@
   EncName enc;
 
 #if DEBUG_FS
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(key,
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Converting reply for query `%s' for gap.\n",
-      &enc);
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(key,
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Converting reply for query `%s' for gap.\n",
+        &enc);
 #endif
   if (ntohl(invalue->type) == ONDEMAND_BLOCK) {
     if (OK != ONDEMAND_getIndexed(datastore,
@@ -657,22 +677,26 @@
                          ggc->keyCount,
                          ggc->keys);
   if (ret == SYSERR) {
-    IF_GELOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-         hash2enc(key,
-                  &enc));
-    GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-       "Converting reply for query `%s' for gap failed (datum not 
applicable).\n",
-       &enc);
+    IF_GELOG(ectx,
+            GE_WARNING | GE_BULK | GE_USER,
+            hash2enc(key,
+                     &enc));
+    GE_LOG(ectx, 
+          GE_WARNING | GE_BULK | GE_USER,
+          "Converting reply for query `%s' for gap failed (datum not 
applicable).\n",
+          &enc);
     FREENONNULL(xvalue);
     return SYSERR; /* no query will ever match */
   }
   if (ret == NO) {
-    IF_GELOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-         hash2enc(key,
-                  &enc));
-    GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-       "Converting reply for query `%s' for gap failed (type not 
applicable).\n",
-       &enc);
+    IF_GELOG(ectx,
+            GE_WARNING | GE_BULK | GE_USER,
+            hash2enc(key,
+                     &enc));
+    GE_LOG(ectx, 
+          GE_WARNING | GE_BULK | GE_USER,
+          "Converting reply for query `%s' for gap failed (type not 
applicable).\n",
+          &enc);
     FREENONNULL(xvalue);
     return OK; /* Additional filtering based on type;
                  i.e., namespace request and namespace
@@ -691,12 +715,14 @@
        refuse to hand out data that requires
        anonymity! */
     FREENONNULL(xvalue);
-    IF_GELOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-         hash2enc(key,
-                  &enc));
-    GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-       "Converting reply for query `%s' for gap failed (insufficient cover 
traffic).\n",
-       &enc);
+    IF_GELOG(ectx,
+            GE_WARNING | GE_BULK | GE_USER,
+            hash2enc(key,
+                     &enc));
+    GE_LOG(ectx, 
+          GE_WARNING | GE_BULK | GE_USER,
+          "Converting reply for query `%s' for gap failed (insufficient cover 
traffic).\n",
+          &enc);
     return OK;
   }
   gw = MALLOC(size);
@@ -747,13 +773,15 @@
 #if DEBUG_FS
   EncName enc;
 
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(&keys[0],
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "GAP requests content for `%s' of type %u\n",
-      &enc,
-      type);
+  IF_GELOG(ectx, 
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(&keys[0],
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "GAP requests content for `%s' of type %u\n",
+        &enc,
+        type);
 #endif
   myClosure.count = 0;
   myClosure.keyCount = keyCount;
@@ -908,13 +936,15 @@
   GGC myClosure;
   EncName enc;
 
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(&keys[0],
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "DHT requests content for %s of type %u\n",
-      &enc,
-      type);
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(&keys[0],
+                   &enc));
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "DHT requests content for %s of type %u\n",
+        &enc,
+        type);
   myClosure.keyCount = keyCount;
   myClosure.keys = keys;
   myClosure.resultCallback = resultCallback;
@@ -1089,15 +1119,17 @@
   }
   rs = (const CS_fs_request_search_MESSAGE*) req;
 #if DEBUG_FS
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(&rs->query[0],
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "FS received QUERY START (query: `%s', ttl %llu, priority %u, anonymity 
%u)\n",
-      &enc,
-      ntohll(rs->expiration) - get_time(),
-      ntohl(rs->prio),
-      ntohl(rs->anonymityLevel));
+  IF_GELOG(ectx, 
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(&rs->query[0],
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "FS received QUERY START (query: `%s', ttl %llu, priority %u, 
anonymity %u)\n",
+        &enc,
+        ntohll(rs->expiration) - get_time(),
+        ntohl(rs->prio),
+        ntohl(rs->anonymityLevel));
 #endif
   type = ntohl(rs->type);
   trackQuery(&rs->query[0],
@@ -1116,9 +1148,10 @@
         &done);
   if (done == YES) {
 #if DEBUG_FS
-    GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       "FS successfully took GAP shortcut for `%s'.\n",
-       &enc);
+    GE_LOG(ectx, 
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          "FS successfully took GAP shortcut for `%s'.\n",
+          &enc);
 #endif
     return OK; 
   }
@@ -1243,18 +1276,19 @@
     dht->join(&dsDht, &dht_table);
   }
 
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      _("`%s' registering client handlers %d %d %d %d %d %d %d %d %d\n"),
-      "fs",
-      CS_PROTO_gap_QUERY_START,
-      CS_PROTO_gap_QUERY_STOP,
-      CS_PROTO_gap_INSERT,
-      CS_PROTO_gap_INDEX,
-      CS_PROTO_gap_DELETE,
-      CS_PROTO_gap_UNINDEX,
-      CS_PROTO_gap_TESTINDEX,
-      CS_PROTO_gap_GET_AVG_PRIORITY,
-      CS_PROTO_gap_INIT_INDEX);
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        _("`%s' registering client handlers %d %d %d %d %d %d %d %d %d\n"),
+        "fs",
+        CS_PROTO_gap_QUERY_START,
+        CS_PROTO_gap_QUERY_STOP,
+        CS_PROTO_gap_INSERT,
+        CS_PROTO_gap_INDEX,
+        CS_PROTO_gap_DELETE,
+        CS_PROTO_gap_UNINDEX,
+        CS_PROTO_gap_TESTINDEX,
+        CS_PROTO_gap_GET_AVG_PRIORITY,
+        CS_PROTO_gap_INIT_INDEX);
 
   GE_ASSERT(ectx, SYSERR != 
capi->registerClientHandler(CS_PROTO_gap_QUERY_START,
                                                      
&csHandleRequestQueryStart));
@@ -1294,11 +1328,13 @@
 
   doneMigration();
   if (dht != NULL) {
-    GE_LOG(ectx, GE_INFO | GE_REQUEST | GE_USER,
-       "Leaving DHT (this may take a while).");
+    GE_LOG(ectx, 
+          GE_INFO | GE_REQUEST | GE_USER,
+          "Leaving DHT (this may take a while).");
     dht->leave(&dht_table);
-    GE_LOG(ectx, GE_INFO | GE_REQUEST | GE_USER,
-       "Leaving DHT complete.");
+    GE_LOG(ectx,
+          GE_INFO | GE_REQUEST | GE_USER,
+          "Leaving DHT complete.");
 
   }
   GE_ASSERT(ectx, SYSERR != 
coreAPI->unregisterClientHandler(CS_PROTO_gap_QUERY_START,

Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c    2006-11-02 22:29:29 UTC 
(rev 3617)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c    2006-11-03 13:43:50 UTC 
(rev 3618)
@@ -28,6 +28,7 @@
  */
 
 #include "platform.h"
+#include "gnunet_directories.h"
 #include "gnunet_fsui_lib.h"
 #include "gnunet_namespace_lib.h"
 #include "gnunet_util_boot.h"
@@ -53,7 +54,7 @@
 
 /* ************ config options ******** */
 
-static char * cfgFilename;
+static char * cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
 
 static struct ECRS_MetaData * meta;
 
@@ -157,8 +158,12 @@
   case FSUI_upload_progress:
     if (*verboselevel) {
       char * ret;
+      cron_t now;
 
-      delta = event->data.UploadProgress.eta - get_time();
+      now = get_time();
+      delta = event->data.UploadProgress.eta - now;
+      if (event->data.UploadProgress.eta < now)
+       delta = 0;
       ret = string_get_fancy_time_interval(delta);
       PRINTF(_("%16llu of %16llu bytes inserted "
               "(estimating %6s to completion) - %s\n"),
@@ -204,7 +209,12 @@
     errorCode = 3;
     GNUNET_SHUTDOWN_INITIATE();
     break;
+  case FSUI_upload_started:
+  case FSUI_upload_stopped:
+    break;
   default:
+    printf(_("\nUnexpected event: %d\n"),
+          event->type);
     GE_BREAK(ectx, 0);
     break;
   }
@@ -298,6 +308,7 @@
   char * tmp;
   unsigned long long verbose;
 
+  meta = ECRS_createMetaData();
   i = GNUNET_init(argc,
                  argv,
                  "gnunet-insert [OPTIONS] FILENAME",
@@ -447,8 +458,10 @@
                        meta,
                        gloKeywords,
                        topKeywords);
-  ECRS_freeUri(gloKeywords);
-  ECRS_freeUri(topKeywords);
+  if (gloKeywords != NULL)
+    ECRS_freeUri(gloKeywords);
+  if (topKeywords != NULL)
+    ECRS_freeUri(topKeywords);
   FREE(tmp);
   if (ul != NULL) {
     GNUNET_SHUTDOWN_WAITFOR();

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2006-11-02 22:29:29 UTC 
(rev 3617)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2006-11-03 13:43:50 UTC 
(rev 3618)
@@ -303,14 +303,8 @@
   if (stats)
     stats->set(stat_size, ret);
   MUTEX_UNLOCK(db->DATABASE_Lock_);
-  return ret * 1.02; 
-  /* benchmarking shows 12% overhead, this is
-     most likely related to the benchmark setup
-     of adding 10% more than quota at a time
-     before cleaning up; overhead without this
-     is usually around 2% during pure insertion;
-     so we take the 2% here, which for frequent
-     cleaning up should be sufficiently accurate */
+  return ret * 1.06; 
+  /* benchmarking shows 2-12% overhead */
 }
 
 /**
@@ -518,6 +512,7 @@
   HashCode512 key;
   sqlite3 * dbh;
   sqliteHandle * handle;
+  int ret;
 
   handle = getDBHandle();
   dbh = handle->dbh;
@@ -527,12 +522,12 @@
       http://permalink.gmane.org/gmane.network.gnunet.devel/1363 */
   strcpy(scratch,
         "SELECT size, type, prio, anonLevel, expire, hash, value FROM gn070"
-        " where rowid in (Select rowid from gn070"
-        " WHERE ((expire == :2 AND prio == :3 AND hash > :1) OR ");
+        " WHERE rowid IN (SELECT rowid FROM gn070"
+        " WHERE ((hash > :1 AND expire == :2 AND prio == :3) OR ");
   if (sortByPriority)
     strcat(scratch,
           "(expire > :4 AND prio == :5) OR prio > :6)");
-  else
+  else 
     strcat(scratch,
           "(prio > :4 AND expire == :5) OR expire > :6)");
   if (type)
@@ -561,7 +556,7 @@
 
   count    = 0;
   lastPrio = 0;
-  lastExp  = 0x8000000000000000LL; /* MIN long long; sqlite does not know 
about unsigned... */
+  lastExp  = 0;
   memset(&key, 0, sizeof(HashCode512));
   while (1) {
     sqlite3_bind_blob(stmt,
@@ -576,13 +571,13 @@
                     3,
                     lastPrio);
     if (sortByPriority) {
-      sqlite3_bind_int(stmt,
-                      4,
-                      lastPrio);
       sqlite3_bind_int64(stmt,
-                        5,
+                        4,
                         lastExp);
       sqlite3_bind_int(stmt,
+                      5,
+                      lastPrio);
+      sqlite3_bind_int(stmt,
                       6,
                       lastPrio);
     } else {
@@ -600,11 +595,10 @@
       sqlite3_bind_int(stmt,
                       7,
                       type);
-    if (sqlite3_step(stmt) == SQLITE_ROW) {
+    if ((ret = sqlite3_step(stmt)) == SQLITE_ROW) {
       datum = assembleDatum(handle,
                            stmt);
       sqlite3_reset(stmt);
-
       if (datum == NULL)
        continue;
 #if 0
@@ -615,15 +609,14 @@
             lastPrio,
             lastExp);
 #endif
-
       if (iter != NULL) {
        MUTEX_UNLOCK(db->DATABASE_Lock_);
        if (SYSERR == iter(&datum->key,
                           &datum->value,
                           closure) ) {
-         count = SYSERR;
          FREE(datum);
          MUTEX_LOCK(db->DATABASE_Lock_);
+         count = SYSERR;
          break;
        }
        MUTEX_LOCK(db->DATABASE_Lock_);
@@ -634,6 +627,14 @@
       FREE(datum);
       count++;
     } else {
+      if (ret != SQLITE_DONE) {
+       LOG_SQLITE(handle,
+                  GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+                  "sqlite_query");
+       sqlite3_finalize(stmt);
+       MUTEX_UNLOCK(db->DATABASE_Lock_);
+       return SYSERR;
+      }
       sqlite3_reset(stmt);
       break;
     }
@@ -757,8 +758,8 @@
                    &enc));
   GE_LOG(ectx,
         GE_DEBUG | GE_REQUEST | GE_USER,
-      "SQLite: retrieving content `%s'\n",
-      &enc);
+        "SQLite: retrieving content `%s'\n",
+        &enc);
 #endif
   handle = getDBHandle();
   dbh = handle->dbh;
@@ -1084,12 +1085,14 @@
 #if DEBUG_SQLITE
   EncName enc;
 
-  IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-       hash2enc(key,
-                &enc));
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "SQLite: updating block with key `%s'\n",
-      &enc);
+  IF_GELOG(ectx, 
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          hash2enc(key,
+                   &enc));
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "SQLite: updating block with key `%s'\n",
+        &enc);
 #endif
 
   dbh = getDBHandle();
@@ -1152,15 +1155,11 @@
   db->lastSync = 0;
 
   afsdir = NULL;
-  if (0 != GC_get_configuration_value_filename(capi->cfg,
-                                              "FS",
-                                              "DIR",
-                                              VAR_DAEMON_DIRECTORY "/data/fs/",
-                                              &afsdir)) {
-    FREE(db);
-    return NULL;
-  }
-
+  GC_get_configuration_value_filename(capi->cfg,
+                                     "FS",
+                                     "DIR",
+                                     VAR_DAEMON_DIRECTORY "/data/fs/",
+                                     &afsdir);
   dir = MALLOC(strlen(afsdir) + 8 + 2); /* 8 = "content/" */
   strcpy(dir, afsdir);
   strcat(dir, "/content/");

Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c        2006-11-02 
22:29:29 UTC (rev 3617)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c        2006-11-03 
13:43:50 UTC (rev 3618)
@@ -49,7 +49,7 @@
  * those take too long to run them in the usual "make check"
  * sequence.  Hence the value used for shipping is tiny.
  */
-#define MAX_SIZE 1024LL * 1024 * 16
+#define MAX_SIZE 1024LL * 1024 * 128
 
 /**
  * Report progress outside of major reports? Should probably be YES if
@@ -137,12 +137,12 @@
   SQstore_ServiceAPI * api = cls;
   static int dc;
 
-  if (api->getSize() < MAX_SIZE)
+  if (api->getSize() < MAX_SIZE) 
     return SYSERR;
   if (GNUNET_SHUTDOWN_TEST() == YES)
     return SYSERR;
   dc++;
-#if REPORT_ID
+#if REPORT_ID 
   if (dc % REP_FREQ == 0)
     fprintf(stderr, "D");
 #endif

Modified: GNUnet/src/include/gnunet_util_getopt.h
===================================================================
--- GNUnet/src/include/gnunet_util_getopt.h     2006-11-02 22:29:29 UTC (rev 
3617)
+++ GNUnet/src/include/gnunet_util_getopt.h     2006-11-03 13:43:50 UTC (rev 
3618)
@@ -163,7 +163,7 @@
  * Set the configuration option for increasing verbosity.
  */
 #define COMMAND_LINE_OPTION_VERBOSE \
-  { 'V', "verbose", NULL, gettext_noop("be verbose"), 1, 
&gnunet_getopt_configure_increment_value, "GNUNET:VERBOSE" }
+  { 'V', "verbose", NULL, gettext_noop("be verbose"), 0, 
&gnunet_getopt_configure_increment_value, "GNUNET:VERBOSE" }
 
 /**
  * Set the configuration option for the configuration file.

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/src/server/connection.c      2006-11-03 13:43:50 UTC (rev 3618)
@@ -2792,12 +2792,12 @@
     max_bpm = new_max_bpm;
     newMAXHOSTS = max_bpm / (MIN_BPM_PER_PEER * 2);
     /* => for 1000 bps, we get 12 (rounded DOWN to 8) connections! */
-    if(newMAXHOSTS < 2)
+    if (newMAXHOSTS < 2)
       newMAXHOSTS = 2;          /* strict minimum is 2 */
-    if(newMAXHOSTS > 256)
+    if (newMAXHOSTS > 256)
       newMAXHOSTS = 256;        /* limit, before we run out of sockets! */
 
-    if(newMAXHOSTS != CONNECTION_MAX_HOSTS_) {
+    if (newMAXHOSTS != CONNECTION_MAX_HOSTS_) {
       /* change size of connection buffer!!! */
       unsigned int olen;
       BufferEntry **newBuffer;
@@ -2834,9 +2834,12 @@
       FREENONNULL(CONNECTION_buffer_);
       CONNECTION_buffer_ = newBuffer;
 
-      GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-          "connection goal is %s%d peers (%llu BPS bandwidth downstream)\n",
-          (olen == 0) ? "" : "now ", CONNECTION_MAX_HOSTS_, max_bpm);
+      GE_LOG(ectx,
+            GE_DEBUG | GE_REQUEST | GE_USER,
+            "connection goal is %s%d peers (%llu BPS bandwidth downstream)\n",
+            (olen == 0) ? "" : "now ",
+            CONNECTION_MAX_HOSTS_,
+            max_bpm);
 
     }
   }
@@ -2865,7 +2868,11 @@
   scl_nextHead = NULL;
   scl_nextTail = NULL;
   lock = MUTEX_CREATE(YES);
-  CONNECTION_MAX_HOSTS_ = 0;
+  connectionConfigChangeCallback(NULL,
+                                cfg,
+                                ectx,
+                                "LOAD",
+                                "NOTHING");
   GE_ASSERT(ectx,
            0 == GC_attach_change_listener(cfg,
                                           &connectionConfigChangeCallback,

Modified: GNUnet/src/server/gnunet-update.c
===================================================================
--- GNUnet/src/server/gnunet-update.c   2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/src/server/gnunet-update.c   2006-11-03 13:43:50 UTC (rev 3618)
@@ -248,14 +248,16 @@
     GNUNET_fini(ectx, cfg);
     return -1;
   }
+  get = NULL;
   if (0 == GC_get_configuration_value_string(cfg,
                                             "GNUNET-UPDATE",
                                             "GET",
-                                            NULL,
+                                            "",
                                             &get)) {
     doGet(get);
     FREE(get);
   } else {
+    FREE(get);
     work();
   }
   GNUNET_fini(ectx, cfg);

Modified: GNUnet/src/server/startup.c
===================================================================
--- GNUnet/src/server/startup.c 2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/src/server/startup.c 2006-11-03 13:43:50 UTC (rev 3618)
@@ -30,6 +30,7 @@
 
 #include "platform.h"
 #include "gnunet_util.h"
+#include "gnunet_directories.h"
 #include "gnunet_protocols.h"
 
 #include "tcpserver.h"
@@ -63,7 +64,7 @@
   if (0 != GC_get_configuration_value_filename(cfg,
                                               "GNUNETD",
                                               "PIDFILE",
-                                              NULL,
+                                              VAR_DAEMON_DIRECTORY 
"/gnunetd.pid",
                                               &pif))
     return NULL;
   return pif;

Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c  2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/src/util/config_impl/impl.c  2006-11-03 13:43:50 UTC (rev 3618)
@@ -265,6 +265,7 @@
             _("Syntax error in configuration file `%s' at line %d.\n"),
             filename, nr);
       ret = -1;
+      break;
     }
   }
   if (0 != fclose(fp)) {

Modified: GNUnet/src/util/os/dso.c
===================================================================
--- GNUnet/src/util/os/dso.c    2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/src/util/os/dso.c    2006-11-03 13:43:50 UTC (rev 3618)
@@ -77,7 +77,7 @@
   ShutdownWinEnv();
 #endif
 
-  lt_dlexit();
+  // lt_dlexit();
 }
 
 struct PluginHandle *

Modified: GNUnet/src/util/os/statuscalls.c
===================================================================
--- GNUnet/src/util/os/statuscalls.c    2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/src/util/os/statuscalls.c    2006-11-03 13:43:50 UTC (rev 3618)
@@ -282,7 +282,7 @@
   if (-1 == GC_get_configuration_value_string(cfg,
                                              "LOAD",
                                              "INTERFACES",
-                                             NULL,
+                                             "eth0",
                                              &interfaces))
     return SYSERR;
   if (interfaces == NULL) {

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-11-02 22:29:29 UTC (rev 3617)
+++ GNUnet/todo 2006-11-03 13:43:50 UTC (rev 3618)
@@ -23,6 +23,7 @@
     + fs/fslib
     + fs/ecrs
     + fs/fsui
+  * FSUI/ECRS/fslib hang if fs module not loaded by gnunetd (!) [pre0]
   * gnunet-setup: [RCpre0]
     + Scheme (scm) specification of entire configuration;
       check options used in modules:
@@ -48,10 +49,7 @@
       - kvstore
     + ncurses wizard
 - fix critical known bugs (see Mantis for updates):
-  * disk quota violations (#1128) [CG, RCpre0]
-    - need to check: why quota-deletion happens during startup
-    - need to check: adding missing indices during gnunet-update
-    - need to check: indexing quota, quota enforcement
+  * adding missing sqlite indices during gnunet-update
   * Windows installer, uninstall: Remove account [Nils, RC]
   * file/socket leak (#955) - possibly fixed
 - More testcases: [RCpre3]





reply via email to

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