gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8986 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r8986 - gnunet/src/fs
Date: Fri, 11 Sep 2009 08:54:45 -0600

Author: grothoff
Date: 2009-09-11 08:54:45 -0600 (Fri, 11 Sep 2009)
New Revision: 8986

Modified:
   gnunet/src/fs/gnunet-service-fs.c
Log:
handling of unindex

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2009-09-11 14:48:40 UTC (rev 8985)
+++ gnunet/src/fs/gnunet-service-fs.c   2009-09-11 14:54:45 UTC (rev 8986)
@@ -24,9 +24,10 @@
  * @author Christian Grothoff
  *
  * TODO:
- * - INDEX_START handling
- * - UNINDEX handling 
+ * - read_index_list
+ * - write_index_list
  * - bloomfilter support (GET, CS-request with BF, etc.)
+ * - handling of on-demand blocks from datastore (need to use indexed-list!)
  * - all P2P messages
  */
 #include "platform.h"
@@ -94,8 +95,9 @@
  * Write the current index information list to disk.
  */ 
 static void
-write_index_list (void)
+write_index_list ()
 {
+  // FIXME
 }
 
 
@@ -103,9 +105,9 @@
  * Read index information from disk.
  */
 static void
-read_index_list (void)
+read_index_list ()
 {
-  
+  // FIXME
 }
 
 
@@ -297,10 +299,38 @@
                const struct GNUNET_MessageHeader *message)
 {
   const struct UnindexMessage *um;
+  struct IndexInfo *pos;
+  struct IndexInfo *prev;
+  struct IndexInfo *next;
   struct GNUNET_SERVER_TransmitContext *tc;
+  int found;
   
   um = (const struct UnindexMessage*) message;
-  // fixme: process!
+  found = GNUNET_NO;
+  prev = NULL;
+  pos = indexed_files;
+  while (NULL != pos)
+    {
+      next = pos->next;
+      if (0 == memcmp (&pos->file_id,
+                      &um->file_id,
+                      sizeof (GNUNET_HashCode)))
+       {
+         if (prev == NULL)
+           indexed_files = pos->next;
+         else
+           prev->next = pos->next;
+         GNUNET_free (pos);
+         found = GNUNET_YES;
+       }
+      else
+       {
+         prev = pos;
+       }
+      pos = next;
+    }
+  if (GNUNET_YES == found)
+    write_index_list ();
   tc = GNUNET_SERVER_transmit_context_create (client);
   GNUNET_SERVER_transmit_context_append (tc,
                                         NULL, 0,
@@ -664,7 +694,8 @@
 {
   struct LocalGetContext *lgc = cls;
   size_t msize;
-  
+
+  // FIXME: handle ONDEMAND blocks!
   if (key == NULL)
     {
       /* no further results from datastore; continue
@@ -736,6 +767,7 @@
 {
   struct LocalGetContext *lgc = cls;
 
+  // FIXME: handle ONDEMAND blocks (change type to ANY for DBLOCK/IBLOCK)
   GNUNET_DATASTORE_get (dsh,
                        &lgc->query,
                        lgc->type,





reply via email to

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