gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2847 - in GNUnet/src: applications/datastore applications/


From: grothoff
Subject: [GNUnet-SVN] r2847 - in GNUnet/src: applications/datastore applications/fs applications/fs/ecrs applications/fs/fsui applications/fs/lib applications/fs/module applications/gap applications/session include util
Date: Fri, 19 May 2006 08:18:33 -0700 (PDT)

Author: grothoff
Date: 2006-05-19 08:18:25 -0700 (Fri, 19 May 2006)
New Revision: 2847

Added:
   GNUnet/src/applications/fs/fsui/fsui-loader.c
Modified:
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/fs/ecrs/keyspace.c
   GNUnet/src/applications/fs/ecrs/search.c
   GNUnet/src/applications/fs/ecrs/uri.c
   GNUnet/src/applications/fs/ecrs_core.c
   GNUnet/src/applications/fs/fsui/Makefile.am
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/fsui/fsui.h
   GNUnet/src/applications/fs/fsui/search.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/fs/module/ondemand.h
   GNUnet/src/applications/fs/module/querymanager.c
   GNUnet/src/applications/gap/gap.c
   GNUnet/src/applications/gap/gap.h
   GNUnet/src/applications/session/connect.c
   GNUnet/src/include/ecrs_core.h
   GNUnet/src/include/gnunet_gap_service.h
   GNUnet/src/include/platform.h
   GNUnet/src/util/hostkey_gcrypt.c
   GNUnet/src/util/logging.c
Log:
working on Mantis 1032

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2006-05-19 12:14:58 UTC 
(rev 2846)
+++ GNUnet/src/applications/datastore/datastore.c       2006-05-19 15:18:25 UTC 
(rev 2847)
@@ -82,8 +82,6 @@
               unsigned int type,
               Datum_Iterator iter,
               void * closure) {
-  int ret;
-
   if (! testAvailable(query)) {
 #if DEBUG_DATASTORE
     EncName enc;
@@ -97,12 +95,10 @@
 #endif
     return 0;
   }
-
-  ret = sq->get(query,
-               type,
-               iter,
-               closure);
-  return ret;
+  return sq->get(query,
+                type,
+                iter,
+                closure);
 }
 
 /**

Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c  2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c  2006-05-19 15:18:25 UTC (rev 
2847)
@@ -64,6 +64,7 @@
   size = ntohl(value->size) - sizeof(Datastore_Value);
   if (OK != getQueryFor(size,
                        (DBlock*) &value[1],
+                       YES,
                        &query))
     return SYSERR;
   GNUNET_ASSERT(type == K_BLOCK);
@@ -231,6 +232,7 @@
     /* extra check: verify sig */
     GNUNET_ASSERT(OK == getQueryFor(size,
                                    (DBlock*) kb,
+                                   YES,
                                    &hc));
 #endif
     freePrivateKey(pk);

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/ecrs/search.c    2006-05-19 15:18:25 UTC (rev 
2847)
@@ -332,6 +332,7 @@
 #endif
   if (OK != getQueryFor(size,
                        (const DBlock*) &value[1],
+                       YES,
                        &query))
     return SYSERR;
   for (i=0;i<sqc->queryCount;i++) {

Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c       2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/ecrs/uri.c       2006-05-19 15:18:25 UTC (rev 
2847)
@@ -85,7 +85,7 @@
 #include "ecrs.h"
 #include "gnunet_ecrs_lib.h"
 
-#define EXTRA_CHECKS YES
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
 
 /**
  * Generate a keyword URI.

Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c      2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/ecrs_core.c      2006-05-19 15:18:25 UTC (rev 
2847)
@@ -155,6 +155,7 @@
  */
 int getQueryFor(unsigned int size,
                const DBlock * data,
+               int verify,
                HashCode512 * query) {
   unsigned int type;
 
@@ -177,13 +178,14 @@
       return SYSERR;
     }
     sb = (const SBlock*) data;
-    if (OK != verifySig(&sb->identifier,
-                       size
-                       - sizeof(Signature)
-                       - sizeof(PublicKey)
-                       - sizeof(unsigned int),
-                       &sb->signature,
-                       &sb->subspace)) {
+    if ( (verify == YES) &&
+        (OK != verifySig(&sb->identifier,
+                         size
+                         - sizeof(Signature)
+                         - sizeof(PublicKey)
+                         - sizeof(unsigned int),
+                         &sb->signature,
+                         &sb->subspace)) ) {
       BREAK();
       return SYSERR;
     }
@@ -197,10 +199,11 @@
       return SYSERR;
     }
     kb = (const KBlock*) data;
-    if ( (OK != verifySig(&kb[1],
-                         size - sizeof(KBlock),
-                         &kb->signature,
-                         &kb->keyspace)) ) {
+    if ( (verify == YES) &&
+        ( (OK != verifySig(&kb[1],
+                           size - sizeof(KBlock),
+                           &kb->signature,
+                           &kb->keyspace)) ) ) {
       BREAK();
       return SYSERR;
     }
@@ -216,13 +219,14 @@
       return SYSERR;
     }
     nb = (const NBlock*) data;
-    if (OK != verifySig(&nb->identifier,
-                       size
-                       - sizeof(Signature)
-                       - sizeof(PublicKey)
-                       - sizeof(unsigned int),
-                       &nb->signature,
-                       &nb->subspace)) {
+    if ( (verify == YES) &&
+        (OK != verifySig(&nb->identifier,
+                         size
+                         - sizeof(Signature)
+                         - sizeof(PublicKey)
+                         - sizeof(unsigned int),
+                         &nb->signature,
+                         &nb->subspace)) ) {
       BREAK();
       return SYSERR;
     }
@@ -236,12 +240,13 @@
       return SYSERR;
     }
     kb = (const KNBlock*) data;
-    if ( (OK != verifySig(&kb->nblock,
-                         size
-                         - sizeof(KBlock)
-                         - sizeof(unsigned int),
-                         &kb->kblock.signature,
-                         &kb->kblock.keyspace)) ) {
+    if ( (verify == YES) &&
+        ( (OK != verifySig(&kb->nblock,
+                           size
+                           - sizeof(KBlock)
+                           - sizeof(unsigned int),
+                           &kb->kblock.signature,
+                           &kb->kblock.keyspace)) ) ) {
       BREAK();
       return SYSERR;
     }
@@ -287,7 +292,7 @@
     BREAK();
     return SYSERR; /* type mismatch */
   }
-  if (OK != getQueryFor(size, data, &hc)) {
+  if (OK != getQueryFor(size, data, YES, &hc)) {
     BREAK(); /* malformed data */
     return SYSERR;
   }

Modified: GNUnet/src/applications/fs/fsui/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/fsui/Makefile.am 2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/fsui/Makefile.am 2006-05-19 15:18:25 UTC (rev 
2847)
@@ -3,6 +3,7 @@
 lib_LTLIBRARIES = \
   libgnunetfsui.la 
 
+noinst_PROGRAMS = fsui-loader
 
 libgnunetfsui_la_SOURCES = \
   collection.c \
@@ -23,6 +24,13 @@
   check.conf
 
 
+fsui_loader_SOURCES = \
+ fsui-loader.c 
+fsui_loader_LDADD = \
+ $(top_builddir)/src/applications/fs/fsui/libgnunetfsui.la \
+ $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+ $(top_builddir)/src/util/libgnunetutil.la 
+
 check_PROGRAMS = \
   fsuitest \
   fsuitest2 \

Added: GNUnet/src/applications/fs/fsui/fsui-loader.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui-loader.c       2006-05-19 12:14:58 UTC 
(rev 2846)
+++ GNUnet/src/applications/fs/fsui/fsui-loader.c       2006-05-19 15:18:25 UTC 
(rev 2847)
@@ -0,0 +1,81 @@
+/*
+     This file is part of GNUnet.
+     (C) 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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file applications/fs/fsui/fsui-loader.c
+ * @brief little program to just load and unload an FSUI file
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_fsui_lib.h"
+
+static void eventCallback(void * cls,
+                         const FSUI_Event * event) {
+#if 0
+  switch(event->type) {
+  case FSUI_search_result:
+    printf("Received search result\n");
+    break;
+  case FSUI_upload_complete:
+    printf("Upload complete.\n");
+    break;
+  case FSUI_download_complete:
+    printf("Download complete.\n");
+    break;
+  case FSUI_unindex_complete:
+    printf("Unindex complete.\n");
+    break;
+  default:
+    printf("Other event.\n");
+    break;
+  }
+#endif
+}
+
+int main(int argc,
+        char * argv[]) {
+  struct FSUI_Context * ctx;
+  if (argc != 2) {
+    fprintf(stderr,
+           "Call with name of FSUI resource file!\n");
+    return -1;
+  }
+  if(OK != initUtil(argc,
+                   argv,
+                   NULL)) {
+    fprintf(stderr,
+           "initUtil failed!\n");
+    return -1;
+  }
+  startCron();
+  ctx = FSUI_start(argv[1],
+                  YES,
+                  &eventCallback,
+                  NULL);
+  if (ctx != NULL)
+    FSUI_stop(ctx);
+  else
+    fprintf(stderr,
+           "FSUI_start failed!\n");
+  stopCron();
+  doneUtil();
+  return (ctx == NULL);
+}

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2006-05-19 15:18:25 UTC (rev 
2847)
@@ -590,7 +590,7 @@
            "FSUI persistence: restarting search\n");
 #endif
        if (0 != PTHREAD_CREATE(&list->handle,
-                               (PThreadMain)&searchThread,
+                               &searchThread,
                                list,
                                16 * 1024))
          DIE_STRERROR("pthread_create");

Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h      2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/fsui/fsui.h      2006-05-19 15:18:25 UTC (rev 
2847)
@@ -406,6 +406,6 @@
 /**
  * FOR RESUME: Thread that searches for data.
  */
-void * searchThread(FSUI_SearchList * pos);
+void * searchThread(void /* FSUI_SearchList */ * pos);
 
 #endif

Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c    2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/fsui/search.c    2006-05-19 15:18:25 UTC (rev 
2847)
@@ -216,7 +216,8 @@
 /**
  * Thread that searches for data.
  */
-void * searchThread(FSUI_SearchList * pos) {
+void * searchThread(void * cls) {
+  FSUI_SearchList * pos = cls;
   ECRS_search(pos->uri,
              pos->anonymityLevel,
              cronTime(NULL) + cronYEARS, /* timeout!?*/
@@ -259,7 +260,7 @@
   pos->anonymityLevel = anonymityLevel;
   pos->ctx = ctx;
   if (0 != PTHREAD_CREATE(&pos->handle,
-                         (PThreadMain) &searchThread,
+                         &searchThread,
                          pos,
                          32 * 1024)) {
     LOG_STRERROR(LOG_ERROR, "PTHREAD_CREATE");

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/lib/fslib.c      2006-05-19 15:18:25 UTC (rev 
2847)
@@ -84,6 +84,7 @@
       size = ntohs(hdr->size) - sizeof(CS_fs_reply_content_MESSAGE);
       if (OK != getQueryFor(size,
                            (DBlock*)&rep[1],
+                           NO, /* gnunetd will have checked already */
                            &query)) {
        BREAK();
        FREE(hdr);

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/fs/module/fs.c      2006-05-19 15:18:25 UTC (rev 
2847)
@@ -43,8 +43,6 @@
 
 #define DEBUG_FS NO
 
-#define EXTRA_CHECKS YES
-
 typedef struct {
   struct DHT_GET_RECORD * rec;
   unsigned int prio;
@@ -54,6 +52,13 @@
   struct DHT_PUT_RECORD * rec;
 } DHT_PUT_CLS;
 
+typedef struct LG_Job { 
+  unsigned int keyCount;
+  unsigned int type;
+  HashCode512 * queries;
+  struct LG_Job * next;
+} LG_Job;
+
 /**
  * Global core API.
  */
@@ -88,6 +93,13 @@
  */
 static DHT_TableId dht_table;
 
+static Semaphore * ltgSignal;
+
+static PTHREAD_T localGetProcessor;
+
+static LG_Job * lg_jobs;
+
+
 static Datastore_Value *
 gapWrapperToDatastoreValue(const DataContainer * value,
                           int prio) {
@@ -159,6 +171,7 @@
   size = ntohl(gw->dc.size) - sizeof(GapWrapper);
   if ( (OK != getQueryFor(size,
                          (DBlock*) &gw[1],
+                         YES,
                          &hc)) ||
        (! equalsHashCode512(&hc, query)) ) {
     BREAK(); /* value failed verification! */
@@ -286,6 +299,7 @@
   datum->anonymityLevel = ri->anonymityLevel;
   if (OK != getQueryFor(ntohs(ri->header.size) - 
sizeof(CS_fs_request_insert_MESSAGE),
                        (const DBlock*)&ri[1],
+                       YES,
                        &query)) {
     BREAK();
     FREE(datum);
@@ -490,6 +504,7 @@
         ntohs(req->size) - sizeof(CS_fs_request_delete_MESSAGE));
   if (OK != getQueryFor(ntohs(rd->header.size) - 
sizeof(CS_fs_request_delete_MESSAGE),
                        (const DBlock*)&rd[1],
+                       NO,
                        &query)) {
     FREE(value);
     BREAK();
@@ -933,6 +948,7 @@
 
 static int uniqueReplyIdentifier(const DataContainer * content,
                                 unsigned int type,
+                                int verify,
                                 const HashCode512 * primaryKey) {
   HashCode512 q;
   unsigned int t;
@@ -947,6 +963,7 @@
   gw = (const GapWrapper*) content;
   if ( (OK == getQueryFor(size - sizeof(GapWrapper),
                          (const DBlock*) &gw[1],
+                         verify,
                          &q)) &&
        (equalsHashCode512(&q,
                          primaryKey)) &&
@@ -965,7 +982,26 @@
 
 static int fastPathProcessor(const HashCode512 * query,
                             const DataContainer * value,
-                            void * cls) {
+                            void * cls) { 
+  Datastore_Value * dv;
+
+  dv = gapWrapperToDatastoreValue(value, 0);
+  if (dv == NULL)
+    return SYSERR;
+  processResponse(query,
+                 dv);
+  FREE(dv);
+  return OK;
+}
+
+/**
+ * FastPathProcessor that only processes the first reply
+ * (essentially to establish "done" == uniqueReplyIdentifier
+ * as true or false.
+ */
+static int fastPathProcessorFirst(const HashCode512 * query,
+                                 const DataContainer * value,
+                                 void * cls) {
   int * done = cls;
   Datastore_Value * dv;
 
@@ -976,13 +1012,61 @@
                  dv);
   if (YES == uniqueReplyIdentifier(value,
                                   ntohl(dv->type),
+                                  NO,
                                   query))
     *done = YES;
   FREE(dv);
-  return OK;
+  return SYSERR;
 }
 
 /**
+ * Thread to lookup local replies to search queries
+ * asynchronously.
+ */
+static void * localGetter(void * noargs) {
+  LG_Job * job;
+  while (1) {
+    SEMAPHORE_DOWN(ltgSignal);
+    MUTEX_LOCK(&lock);
+    if (lg_jobs == NULL) {
+      MUTEX_UNLOCK(&lock);
+      break;
+    }
+    job = lg_jobs;
+    lg_jobs = job->next;
+    MUTEX_UNLOCK(&lock);
+    gapGet(NULL,
+          job->type,
+          EXTREME_PRIORITY,
+          job->keyCount,
+          job->queries,
+          &fastPathProcessor,
+          NULL);
+    FREE(job->queries);
+    FREE(job);
+  }
+  return NULL;
+}
+
+static void queueLG_Job(unsigned int type,
+                       unsigned int keyCount,
+                       const HashCode512 * queries) {
+  LG_Job * job;
+
+  job = MALLOC(sizeof(LG_Job));
+  job->keyCount = keyCount;
+  job->queries = MALLOC(sizeof(HashCode512) * keyCount);
+  memcpy(job->queries,
+        queries,
+        sizeof(HashCode512) * keyCount);
+  MUTEX_LOCK(&lock);
+  job->next = lg_jobs;
+  lg_jobs = job;
+  MUTEX_UNLOCK(&lock);
+  SEMAPHORE_UP(ltgSignal);
+}
+
+/**
  * Process a query from the client. Forwards to the network.
  *
  * @return SYSERR if the TCP connection should be closed, otherwise OK
@@ -1023,7 +1107,7 @@
         EXTREME_PRIORITY,
         keyCount,
         &rs->query[0],
-        &fastPathProcessor,
+        &fastPathProcessorFirst,
         &done);
   if (done == YES) {
 #if DEBUG_FS
@@ -1032,6 +1116,11 @@
 #endif
     return OK; 
   }
+
+  /* run gapGet asynchronously (since it may take a while due to lots of IO) */
+  queueLG_Job(type,
+             keyCount,
+             &rs->query[0]);
   gap->get_start(type,
                 ntohl(rs->anonymityLevel),
                 keyCount,
@@ -1078,7 +1167,7 @@
   GNUNET_ASSERT(sizeof(SBlock) == 724);
   GNUNET_ASSERT(sizeof(NBlock) == 716);
   GNUNET_ASSERT(sizeof(KNBlock) == 1244);
-
+  
   migration = testConfigurationString("FS",
                                      "ACTIVEMIGRATION",
                                      "YES");
@@ -1106,7 +1195,12 @@
   }
   /* dht = capi->requestService("dht"); */
   dht = NULL;
-
+  ltgSignal = SEMAPHORE_NEW(0);
+  if (0 != PTHREAD_CREATE(&localGetProcessor,
+                         &localGetter,
+                         NULL,
+                         16 * 1024))
+    DIE_STRERROR("pthread_create");
   coreAPI = capi;
   ONDEMAND_init();
   MUTEX_CREATE(&lock);
@@ -1174,6 +1268,9 @@
 }
 
 void done_module_fs() {
+  LG_Job * job;
+  void * unused;
+
   doneMigration();
   if (dht != NULL) {
     LOG(LOG_INFO,
@@ -1202,6 +1299,15 @@
   GNUNET_ASSERT(SYSERR != 
coreAPI->unregisterClientHandler(CS_PROTO_gap_GET_AVG_PRIORITY,
                                                           
&csHandleRequestGetAvgPriority));
   doneQueryManager();
+  while (lg_jobs != NULL) {
+    job = lg_jobs->next;
+    FREE(lg_jobs->queries);
+    FREE(lg_jobs);
+    lg_jobs = job;
+  }
+  SEMAPHORE_UP(ltgSignal); /* lg_jobs == NULL => thread will terminate */
+  PTHREAD_JOIN(&localGetProcessor,
+              &unused);
   coreAPI->releaseService(datastore);
   datastore = NULL;
   coreAPI->releaseService(gap);

Modified: GNUnet/src/applications/fs/module/ondemand.h
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.h        2006-05-19 12:14:58 UTC 
(rev 2846)
+++ GNUnet/src/applications/fs/module/ondemand.h        2006-05-19 15:18:25 UTC 
(rev 2847)
@@ -31,7 +31,7 @@
 #include "gnunet_datastore_service.h"
 #include "ecrs_core.h"
 
-#define EXTRA_CHECKS YES
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
 
 /**
  * Creates a symlink to the given file in the shared directory

Modified: GNUnet/src/applications/fs/module/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/module/querymanager.c    2006-05-19 12:14:58 UTC 
(rev 2846)
+++ GNUnet/src/applications/fs/module/querymanager.c    2006-05-19 15:18:25 UTC 
(rev 2847)
@@ -128,7 +128,7 @@
 }
 
 /**
- * We received a reply from 'responder'.
+ * We received a reply.
  * Forward to client (if appropriate).
  *
  * @param value the response

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2006-05-19 12:14:58 UTC (rev 2846)
+++ GNUnet/src/applications/gap/gap.c   2006-05-19 15:18:25 UTC (rev 2847)
@@ -782,6 +782,7 @@
   /* verify data is valid */
   uri(data,
       ANY_BLOCK,
+      YES,
       primaryKey);
 #endif
 
@@ -1328,6 +1329,7 @@
   /* verify data is valid */
   uri(value,
       ANY_BLOCK,
+      YES,
       primaryKey);
 #endif
 
@@ -1500,6 +1502,7 @@
 
       if (uri(cls.values[perm[i]],
              ite->type,
+             NO, /* no need to verify local results! */
              &query->queries[0]))
        doForward = NO; /* we have the one and only answer,
                                do not bother to forward... */
@@ -1614,9 +1617,6 @@
        _("GAP received invalid content from `%s'\n"),
        (host != NULL) ? (const char*)&enc : _("myself"));    
     BREAK();
-    uri(value,
-       ANY_BLOCK,
-       &contentHC);
     FREE(value);
     return SYSERR; /* invalid */
   }
@@ -1654,6 +1654,7 @@
       ite->seenReplyWasUnique
        = uri(value,
              ite->type,
+             NO, /* already verified */
              &ite->primaryKey);
     } else {
       ite->seenReplyWasUnique = NO;
@@ -1699,6 +1700,7 @@
   /* FIFTH: if unique reply, stopy querying */
   if (uri(value,
          ite->type,
+         NO, /* already verified */
          &ite->primaryKey)) {
     /* unique reply, stop forwarding! */
     dequeueQuery(&ite->primaryKey);

Modified: GNUnet/src/applications/gap/gap.h
===================================================================
--- GNUnet/src/applications/gap/gap.h   2006-05-19 12:14:58 UTC (rev 2846)
+++ GNUnet/src/applications/gap/gap.h   2006-05-19 15:18:25 UTC (rev 2847)
@@ -39,7 +39,7 @@
 
 #define DEBUG_GAP NO
 
-#define EXTRA_CHECKS YES
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
 
 
 /* ***************** policy constants **************** */

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/applications/session/connect.c   2006-05-19 15:18:25 UTC (rev 
2847)
@@ -39,7 +39,7 @@
 
 #define DEBUG_SESSION NO
 
-#define EXTRA_CHECKS YES
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
 
 static CoreAPIForApplication * coreAPI;
 

Modified: GNUnet/src/include/ecrs_core.h
===================================================================
--- GNUnet/src/include/ecrs_core.h      2006-05-19 12:14:58 UTC (rev 2846)
+++ GNUnet/src/include/ecrs_core.h      2006-05-19 15:18:25 UTC (rev 2847)
@@ -198,12 +198,15 @@
  *
  * @param type the type of the encoding
  * @param data the content (encoded)
+ * @param verify should the data be verified?  Use NO if
+ *         data integrity has been checked before (maybe much faster!)
  * @param query set to the query for the content
  * @return SYSERR if the content is invalid or
  *   the content type is not known
  */
 int getQueryFor(unsigned int size,
                const DBlock * data,
+               int verify,
                HashCode512 * query);
 
 /**

Modified: GNUnet/src/include/gnunet_gap_service.h
===================================================================
--- GNUnet/src/include/gnunet_gap_service.h     2006-05-19 12:14:58 UTC (rev 
2846)
+++ GNUnet/src/include/gnunet_gap_service.h     2006-05-19 15:18:25 UTC (rev 
2847)
@@ -46,9 +46,11 @@
  * Function that helps the routing code to find out if
  * a given reply is the one and only reply for a given
  * request.
+ * @param verify check that content is valid? (YES/NO)
  */
 typedef int (*UniqueReplyIdentifier)(const DataContainer * content,
                                     unsigned int query_type,
+                                    int verify,
                                     const HashCode512 * primaryKey);
 
 /**

Modified: GNUnet/src/include/platform.h
===================================================================
--- GNUnet/src/include/platform.h       2006-05-19 12:14:58 UTC (rev 2846)
+++ GNUnet/src/include/platform.h       2006-05-19 15:18:25 UTC (rev 2847)
@@ -33,6 +33,8 @@
 #include "config.h"
 #endif
 
+#define ALLOW_EXTRA_CHECKS  YES
+
 #include "plibc.h"
 
 /**

Modified: GNUnet/src/util/hostkey_gcrypt.c
===================================================================
--- GNUnet/src/util/hostkey_gcrypt.c    2006-05-19 12:14:58 UTC (rev 2846)
+++ GNUnet/src/util/hostkey_gcrypt.c    2006-05-19 15:18:25 UTC (rev 2847)
@@ -45,9 +45,10 @@
 };
 
 #define HOSTKEY_LEN 2048
-#define EXTRA_CHECKS YES
 
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
 
+
 /**
  * Log an error message at log-level 'level' that indicates
  * a failure of the command 'cmd' with the message given

Modified: GNUnet/src/util/logging.c
===================================================================
--- GNUnet/src/util/logging.c   2006-05-19 12:14:58 UTC (rev 2846)
+++ GNUnet/src/util/logging.c   2006-05-19 15:18:25 UTC (rev 2847)
@@ -436,6 +436,7 @@
       lastlog = lcltime->tm_yday;
     }
 
+
     printTime();
     if (format[0] == ' ')
       FPRINTF(logfile, "%s:", gettext(loglevels[minLogLevel]));





reply via email to

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