gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r302 - in GNUnet: . src/applications/fs/ecrs src/applicatio


From: grothoff
Subject: [GNUnet-SVN] r302 - in GNUnet: . src/applications/fs/ecrs src/applications/fs/lib src/include
Date: Thu, 24 Feb 2005 22:46:36 -0800 (PST)

Author: grothoff
Date: 2005-02-24 22:46:35 -0800 (Thu, 24 Feb 2005)
New Revision: 302

Modified:
   GNUnet/src/applications/fs/ecrs/search.c
   GNUnet/src/applications/fs/ecrs/unindex.c
   GNUnet/src/applications/fs/lib/check.conf
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/include/gnunet_ecrs_lib.h
   GNUnet/todo
Log:
bugfixes

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2005-02-25 06:13:26 UTC (rev 
301)
+++ GNUnet/src/applications/fs/ecrs/search.c    2005-02-25 06:46:35 UTC (rev 
302)
@@ -306,6 +306,7 @@
   int i;
   unsigned int size;
   PendingSearch * ps;
+  int ret;
 
   type = ntohl(value->type);
   size = ntohl(value->size) - sizeof(Datastore_Value);
@@ -358,12 +359,12 @@
          ECRS_freeMetaData(fi.meta);
          return SYSERR;
        }
-       sqc->spcb(&fi, 
-                 &ps->decryptKey,
-                 sqc->spcbClosure);
+       ret = sqc->spcb(&fi, 
+                       &ps->decryptKey,
+                       sqc->spcbClosure);
        ECRS_freeUri(fi.uri);
        ECRS_freeMetaData(fi.meta);
-       return OK;      
+       return ret;      
       }
       case N_BLOCK: {
        NBlock * nb;
@@ -429,7 +430,7 @@
          ECRS_freeMetaData(fi.meta);
          return SYSERR;
        }
-       sqc->spcb(&fi, NULL, sqc->spcbClosure);
+       ret = sqc->spcb(&fi, NULL, sqc->spcbClosure);
        ECRS_freeUri(fi.uri);
        ECRS_freeMetaData(fi.meta);
 
@@ -440,7 +441,7 @@
          return SYSERR;
        if (equalsHashCode160(&updateId,
                              &ps->decryptKey))
-         return OK; /* have latest version */
+         return ret; /* have latest version */
        if (ps->keyCount != 2) {
          BREAK();
          return SYSERR;
@@ -451,7 +452,7 @@
        updateURI.data.sks.identifier = updateId;
        addQueryForURI(&updateURI,
                       sqc);
-       return OK;
+       return ret;
       }
       default:
        BREAK();
@@ -466,6 +467,7 @@
 /**
  * Search for content.
  *
+ * @param timeout how long to wait (relative)
  * @param uri specifies the search parameters
  * @param uri set to the URI of the uploaded file
  */
@@ -485,6 +487,8 @@
   unsigned int new_priority;
 
   cronTime(&ctx.start);
+  cronTime(&now);
+  timeout += now;
   ctx.timeout = timeout;
   ctx.queryCount = 0;
   ctx.queries = NULL;
@@ -494,7 +498,6 @@
   ctx.sctx = FS_SEARCH_makeContext(&ctx.lock);
   addQueryForURI(uri,
                 &ctx);
-  cronTime(&now);
   while ( (OK == tt(ttClosure)) &&
          (timeout > now) ) {
     remTime = timeout - now;

Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c   2005-02-25 06:13:26 UTC (rev 
301)
+++ GNUnet/src/applications/fs/ecrs/unindex.c   2005-02-25 06:46:35 UTC (rev 
302)
@@ -110,8 +110,8 @@
   char * tmpName;
   HashCode160 serverFileId;
   struct stat buf;
+  int ret;
 
-
 #ifndef S_ISLNK
   return OK; /* symlinks do not exist? */
 #endif
@@ -140,18 +140,20 @@
   hash2enc(fileId,
           &enc);
   strcat(serverFN,
-        (char*)&enc);
+        (char*)&enc);  
   tmpName = MALLOC(strlen(serverFN + 5));
-  if (0 != readlink(fn,
-                   tmpName,
-                   strlen(serverFN) + 4)) {
+  ret = readlink(fn,
+                tmpName,
+                strlen(serverFN) + 4);
+  if (ret == -1) {
     LOG_FILE_STRERROR(LOG_ERROR, "readlink", fn);
     FREE(tmpName);
     FREE(serverFN);
     return SYSERR;
   }
-  if (0 != strcmp(tmpName,
-                 serverFN)) {
+  if ( (ret == strlen(serverFN) + 4) ||
+       (0 != strcmp(tmpName,
+                   serverFN)) ) {
     FREE(tmpName);
     FREE(serverFN);
     return OK; /* symlink elsewhere... */
@@ -297,7 +299,7 @@
   db = (DBlock*) &dblock[1];
   db->type = htonl(D_BLOCK);
   iblocks = MALLOC(sizeof(Datastore_Value*) * treedepth);
-  for (i=0;i<treedepth;i++) {
+  for (i=0;i<=treedepth;i++) {
     iblocks[i] = MALLOC(sizeof(Datastore_Value) + IBLOCK_SIZE + 
sizeof(DBlock));
     iblocks[i]->size = htonl(sizeof(Datastore_Value) + sizeof(DBlock));
     iblocks[i]->anonymityLevel = htonl(0);

Modified: GNUnet/src/applications/fs/lib/check.conf
===================================================================
--- GNUnet/src/applications/fs/lib/check.conf   2005-02-25 06:13:26 UTC (rev 
301)
+++ GNUnet/src/applications/fs/lib/check.conf   2005-02-25 06:46:35 UTC (rev 
302)
@@ -15,7 +15,7 @@
 # TRANSPORTS = -- no transports!
 
 [MODULES]
-sqstore = "sqstore_mysql"
+sqstore = "sqstore_sqlite"
 # FIXME: use sqstore here once available!
 
 [NETWORK]

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2005-02-25 06:13:26 UTC (rev 
301)
+++ GNUnet/src/applications/fs/lib/fslib.c      2005-02-25 06:46:35 UTC (rev 
302)
@@ -87,20 +87,24 @@
                              &ctx->handles[i]->req->query[0])) {
          Datastore_Value * value;
 
-         value = MALLOC(sizeof(Datastore_Value) + size);
-         value->size = htonl(size + sizeof(Datastore_Value));
-         value->type = htonl(getTypeOfBlock(size,
-                                            (DBlock*) &rep[1]));
-         value->prio = htonl(0);
-         value->anonymityLevel = htonl(0);
-         value->expirationTime = htonll(0);
-         memcpy(&value[1],
-                &rep[1],
-                size);
-         ctx->handles[i]->callback(&query,
-                                   value,
-                                   ctx->handles[i]->closure);
-         FREE(value);
+         if (ctx->handles[i]->callback != NULL) {          
+           value = MALLOC(sizeof(Datastore_Value) + size);
+           value->size = htonl(size + sizeof(Datastore_Value));
+           value->type = htonl(getTypeOfBlock(size,
+                                              (DBlock*) &rep[1]));
+           value->prio = htonl(0);
+           value->anonymityLevel = htonl(0);
+           value->expirationTime = htonll(0);
+           memcpy(&value[1],
+                  &rep[1],
+                  size);
+           if (SYSERR == ctx->handles[i]->callback(&query,
+                                                   value,
+                                                   ctx->handles[i]->closure)) {
+             ctx->handles[i]->callback = NULL;
+           }
+           FREE(value);
+         }
        }
       }
       MUTEX_UNLOCK(ctx->lock);      

Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h        2005-02-25 06:13:26 UTC (rev 
301)
+++ GNUnet/src/include/gnunet_ecrs_lib.h        2005-02-25 06:46:35 UTC (rev 
302)
@@ -439,6 +439,7 @@
 /**
  * Search for content.
  *
+ * @param timeout how long to wait (relative)
  * @param uri specifies the search parameters
  * @param uri set to the URI of the uploaded file
  */

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-02-25 06:13:26 UTC (rev 301)
+++ GNUnet/todo 2005-02-25 06:46:35 UTC (rev 302)
@@ -28,7 +28,6 @@
 - fslibtest: implement verify result
 - fslibtest/ecrstest: make GNUnet use 'check' database (not main DB!)
 - topology: do aggressive bootstrap on first start (Christian) [ easy ]
-- sqlite sqstore implementation does not compile yet (Nils)
 - gnunet-search: 
   * dump directory with search results [ easy ]
 - ecrs-search:





reply via email to

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