gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11143 - gnunet/src/fs
Date: Sat, 1 May 2010 13:16:23 +0200

Author: grothoff
Date: 2010-05-01 13:16:23 +0200 (Sat, 01 May 2010)
New Revision: 11143

Modified:
   gnunet/src/fs/fs.c
Log:
unindex syncing

Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c  2010-05-01 11:11:49 UTC (rev 11142)
+++ gnunet/src/fs/fs.c  2010-05-01 11:16:23 UTC (rev 11143)
@@ -1158,7 +1158,7 @@
       return;
     }
   wh = get_write_handle (pc->h, "publish", pc->serialization);
- if ( (GNUNET_OK !=
+  if ( (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, pc->nid)) ||
        (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, pc->nuid)) ||
@@ -1201,7 +1201,45 @@
 void
 GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc)
 {
-  /* FIXME */
+  struct GNUNET_BIO_WriteHandle *wh;
+
+  if (UNINDEX_STATE_ABORTED == uc->state)
+    return;
+  if (NULL == uc->serialization)
+    uc->serialization = make_serialization_file_name (uc->h,
+                                                     "unindex");
+  if (NULL == uc->serialization)
+    return;
+  wh = get_write_handle (uc->h, "unindex", uc->serialization);
+  if ( (GNUNET_OK !=
+       GNUNET_BIO_write_string (wh, uc->filename)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_int64 (wh, uc->file_size)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_int64 (wh, uc->start_time.value)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_int32 (wh, (uint32_t) uc->state)) ||
+       ( (uc->state == UNINDEX_STATE_FS_NOTIFY) &&
+        (GNUNET_OK !=
+         GNUNET_BIO_write (wh, &uc->file_id, sizeof (GNUNET_HashCode))) ) ||
+       ( (uc->state == UNINDEX_STATE_ERROR) &&
+        (GNUNET_OK !=
+         GNUNET_BIO_write_string (wh, uc->emsg)) ) )
+    {
+      (void) GNUNET_BIO_write_close (wh);
+      GNUNET_FS_remove_sync_file_ (uc->h, "publish", uc->serialization);
+      GNUNET_free (uc->serialization);
+      uc->serialization = NULL;
+      return;
+    }
+  if (GNUNET_OK !=
+      GNUNET_BIO_write_close (wh))
+    {
+      GNUNET_FS_remove_sync_file_ (uc->h, "unindex", uc->serialization);
+      GNUNET_free (uc->serialization);
+      uc->serialization = NULL;
+      return;     
+    }  
 }
 
 





reply via email to

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