aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-01 11:16:23 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-01 11:16:23 +0000
commit2e299a2058eae306186a2df684d73f353ecb2609 (patch)
tree32f0c554ac747c5189f912440242eb6db4db2c47 /src/fs
parentf1ba456f5149979d72c6ddb40cc76d0379ff0518 (diff)
downloadgnunet-2e299a2058eae306186a2df684d73f353ecb2609.tar.gz
gnunet-2e299a2058eae306186a2df684d73f353ecb2609.zip
unindex syncing
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/fs/fs.c b/src/fs/fs.c
index 417461404..c0271282a 100644
--- a/src/fs/fs.c
+++ b/src/fs/fs.c
@@ -1158,7 +1158,7 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc)
1158 return; 1158 return;
1159 } 1159 }
1160 wh = get_write_handle (pc->h, "publish", pc->serialization); 1160 wh = get_write_handle (pc->h, "publish", pc->serialization);
1161 if ( (GNUNET_OK != 1161 if ( (GNUNET_OK !=
1162 GNUNET_BIO_write_string (wh, pc->nid)) || 1162 GNUNET_BIO_write_string (wh, pc->nid)) ||
1163 (GNUNET_OK != 1163 (GNUNET_OK !=
1164 GNUNET_BIO_write_string (wh, pc->nuid)) || 1164 GNUNET_BIO_write_string (wh, pc->nuid)) ||
@@ -1201,7 +1201,45 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc)
1201void 1201void
1202GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc) 1202GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc)
1203{ 1203{
1204 /* FIXME */ 1204 struct GNUNET_BIO_WriteHandle *wh;
1205
1206 if (UNINDEX_STATE_ABORTED == uc->state)
1207 return;
1208 if (NULL == uc->serialization)
1209 uc->serialization = make_serialization_file_name (uc->h,
1210 "unindex");
1211 if (NULL == uc->serialization)
1212 return;
1213 wh = get_write_handle (uc->h, "unindex", uc->serialization);
1214 if ( (GNUNET_OK !=
1215 GNUNET_BIO_write_string (wh, uc->filename)) ||
1216 (GNUNET_OK !=
1217 GNUNET_BIO_write_int64 (wh, uc->file_size)) ||
1218 (GNUNET_OK !=
1219 GNUNET_BIO_write_int64 (wh, uc->start_time.value)) ||
1220 (GNUNET_OK !=
1221 GNUNET_BIO_write_int32 (wh, (uint32_t) uc->state)) ||
1222 ( (uc->state == UNINDEX_STATE_FS_NOTIFY) &&
1223 (GNUNET_OK !=
1224 GNUNET_BIO_write (wh, &uc->file_id, sizeof (GNUNET_HashCode))) ) ||
1225 ( (uc->state == UNINDEX_STATE_ERROR) &&
1226 (GNUNET_OK !=
1227 GNUNET_BIO_write_string (wh, uc->emsg)) ) )
1228 {
1229 (void) GNUNET_BIO_write_close (wh);
1230 GNUNET_FS_remove_sync_file_ (uc->h, "publish", uc->serialization);
1231 GNUNET_free (uc->serialization);
1232 uc->serialization = NULL;
1233 return;
1234 }
1235 if (GNUNET_OK !=
1236 GNUNET_BIO_write_close (wh))
1237 {
1238 GNUNET_FS_remove_sync_file_ (uc->h, "unindex", uc->serialization);
1239 GNUNET_free (uc->serialization);
1240 uc->serialization = NULL;
1241 return;
1242 }
1205} 1243}
1206 1244
1207 1245