aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO21
-rw-r--r--src/fs/Makefile.am1
-rw-r--r--src/fs/fs.c5
-rw-r--r--src/fs/fs.h7
-rw-r--r--src/fs/fs_unindex.c62
-rw-r--r--src/fs/test_fs_unindex_persistence.c21
6 files changed, 81 insertions, 36 deletions
diff --git a/TODO b/TODO
index 0eb7fc6b2..bf30d665a 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,14 @@
10.9.0pre1: 10.9.0pre1:
2* MIGRATION [CG]
3 - on-demand encoding => move logic to block-library!?
4 - peer selection => how to consider latency/bw/etc?
5 - content transmission => how often the same block?
6 - how to select delay before next migration?
7 - migration to us
8 - testing
9 - integrate with FS or not? (peer list, index/on-demand encoding, block code,
10 inbound priority assignment; all would be easier with tight integration!)
2* FS: [CG] 11* FS: [CG]
3 - persistence testing (unindex, search):
4 * unindex:
5 + need to clean up state on stop/suspend (including file-hashing => util API change!)
6 - gnunet-service-fs (hot-path routing, load-based routing, nitpicks) 12 - gnunet-service-fs (hot-path routing, load-based routing, nitpicks)
7 - [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is never used 13 - [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is never used
8 - [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is never used 14 - [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is never used
@@ -14,15 +20,6 @@
14 - [gnunet-service-fs.c:700]: member 'ConnectedPeer::last_client_replies_woff' is never used 20 - [gnunet-service-fs.c:700]: member 'ConnectedPeer::last_client_replies_woff' is never used
15 - GAP improvements: 21 - GAP improvements:
16 + active reply route caching design & implementation of service; gap extension! 22 + active reply route caching design & implementation of service; gap extension!
17* MIGRATION [CG]
18 - on-demand encoding => move logic to block-library!?
19 - peer selection => how to consider latency/bw/etc?
20 - content transmission => how often the same block?
21 - how to select delay before next migration?
22 - migration to us
23 - testing
24 - integrate with FS or not? (peer list, index/on-demand encoding, block code,
25 inbound priority assignment; all would be easier with tight integration!)
26* TBENCH: [MW] 23* TBENCH: [MW]
27 - good to have for transport/DV evaluation! 24 - good to have for transport/DV evaluation!
28* DV: [Nate] 25* DV: [Nate]
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 2881ab4fa..9c9fd7525 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -157,6 +157,7 @@ TESTS = $(check_SCRIPTS) \
157 test_fs_search_persistence \ 157 test_fs_search_persistence \
158 test_fs_start_stop \ 158 test_fs_start_stop \
159 test_fs_unindex \ 159 test_fs_unindex \
160 test_fs_unindex_persistence \
160 test_fs_uri \ 161 test_fs_uri \
161 test_fs_test_lib \ 162 test_fs_test_lib \
162 test_gnunet_service_fs_p2p 163 test_gnunet_service_fs_p2p
diff --git a/src/fs/fs.c b/src/fs/fs.c
index 1968a8453..1226db707 100644
--- a/src/fs/fs.c
+++ b/src/fs/fs.c
@@ -1571,8 +1571,6 @@ GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc)
1571{ 1571{
1572 struct GNUNET_BIO_WriteHandle *wh; 1572 struct GNUNET_BIO_WriteHandle *wh;
1573 1573
1574 if (UNINDEX_STATE_ABORTED == uc->state)
1575 return;
1576 if (NULL == uc->serialization) 1574 if (NULL == uc->serialization)
1577 uc->serialization = make_serialization_file_name (uc->h, 1575 uc->serialization = make_serialization_file_name (uc->h,
1578 GNUNET_FS_SYNC_PATH_MASTER_UNINDEX); 1576 GNUNET_FS_SYNC_PATH_MASTER_UNINDEX);
@@ -2038,9 +2036,6 @@ deserialize_unindex_file (void *cls,
2038 goto cleanup; 2036 goto cleanup;
2039 } 2037 }
2040 break; 2038 break;
2041 case UNINDEX_STATE_ABORTED:
2042 GNUNET_break (0);
2043 goto cleanup;
2044 default: 2039 default:
2045 GNUNET_break (0); 2040 GNUNET_break (0);
2046 goto cleanup; 2041 goto cleanup;
diff --git a/src/fs/fs.h b/src/fs/fs.h
index bca8fc691..c0e203335 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -1339,13 +1339,8 @@ enum UnindexState
1339 /** 1339 /**
1340 * We've encountered a fatal error. 1340 * We've encountered a fatal error.
1341 */ 1341 */
1342 UNINDEX_STATE_ERROR = 4, 1342 UNINDEX_STATE_ERROR = 4
1343 1343
1344 /**
1345 * We've been aborted. The next callback should clean up the
1346 * struct.
1347 */
1348 UNINDEX_STATE_ABORTED = 5
1349 }; 1344 };
1350 1345
1351 1346
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c
index db0540607..349cc4251 100644
--- a/src/fs/fs_unindex.c
+++ b/src/fs/fs_unindex.c
@@ -243,6 +243,7 @@ unindex_finish (void *cls,
243 GNUNET_FS_tree_encoder_finish (uc->tc, 243 GNUNET_FS_tree_encoder_finish (uc->tc,
244 &uri, 244 &uri,
245 &emsg); 245 &emsg);
246 uc->tc = NULL;
246 if (uri != NULL) 247 if (uri != NULL)
247 GNUNET_FS_uri_destroy (uri); 248 GNUNET_FS_uri_destroy (uri);
248 GNUNET_DISK_file_close (uc->fh); 249 GNUNET_DISK_file_close (uc->fh);
@@ -251,11 +252,13 @@ unindex_finish (void *cls,
251 uc->dsh = NULL; 252 uc->dsh = NULL;
252 if (emsg != NULL) 253 if (emsg != NULL)
253 { 254 {
255 uc->state = UNINDEX_STATE_ERROR;
254 uc->emsg = emsg; 256 uc->emsg = emsg;
255 signal_unindex_error (uc); 257 signal_unindex_error (uc);
256 } 258 }
257 else 259 else
258 { 260 {
261 uc->state = UNINDEX_STATE_COMPLETE;
259 pi.status = GNUNET_FS_STATUS_UNINDEX_COMPLETED; 262 pi.status = GNUNET_FS_STATUS_UNINDEX_COMPLETED;
260 pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO; 263 pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO;
261 GNUNET_FS_unindex_make_status_ (&pi, uc, uc->file_size); 264 GNUNET_FS_unindex_make_status_ (&pi, uc, uc->file_size);
@@ -284,7 +287,10 @@ process_fs_response (void *cls,
284 } 287 }
285 if (uc->state != UNINDEX_STATE_FS_NOTIFY) 288 if (uc->state != UNINDEX_STATE_FS_NOTIFY)
286 { 289 {
287 GNUNET_FS_unindex_stop (uc); 290 uc->state = UNINDEX_STATE_ERROR;
291 uc->emsg = GNUNET_strdup (_("Unexpected time for a response from `fs' service."));
292 GNUNET_FS_unindex_sync_ (uc);
293 signal_unindex_error (uc);
288 return; 294 return;
289 } 295 }
290 if (NULL == msg) 296 if (NULL == msg)
@@ -416,6 +422,28 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls)
416 GNUNET_CRYPTO_hash_file_cancel (uc->fhc); 422 GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
417 uc->fhc = NULL; 423 uc->fhc = NULL;
418 } 424 }
425 if (uc->client != NULL)
426 {
427 GNUNET_CLIENT_disconnect (uc->client, GNUNET_NO);
428 uc->client = NULL;
429 }
430 if (NULL != uc->dsh)
431 {
432 GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
433 uc->dsh = NULL;
434 }
435 if (NULL != uc->tc)
436 {
437 GNUNET_FS_tree_encoder_finish (uc->tc,
438 NULL,
439 NULL);
440 uc->tc = NULL;
441 }
442 if (uc->fh != NULL)
443 {
444 GNUNET_DISK_file_close (uc->fh);
445 uc->fh = NULL;
446 }
419 GNUNET_FS_end_top (uc->h, uc->top); 447 GNUNET_FS_end_top (uc->h, uc->top);
420 pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND; 448 pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND;
421 GNUNET_FS_unindex_make_status_ (&pi, uc, 449 GNUNET_FS_unindex_make_status_ (&pi, uc,
@@ -488,17 +516,29 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc)
488 GNUNET_CRYPTO_hash_file_cancel (uc->fhc); 516 GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
489 uc->fhc = NULL; 517 uc->fhc = NULL;
490 } 518 }
491 /* FIXME: disconnect uc->client (if still connected) */ 519 if (uc->client != NULL)
492 /* FIXME: disconnect from datastore (if still connected) */
493 /* FIXME: other termination operations? */
494 /* FIXME: must do same cleanup in 'unindex_signal_suspend'! */
495 GNUNET_FS_end_top (uc->h, uc->top);
496 if ( (uc->state != UNINDEX_STATE_COMPLETE) &&
497 (uc->state != UNINDEX_STATE_ERROR) )
498 { 520 {
499 uc->state = UNINDEX_STATE_ABORTED; 521 GNUNET_CLIENT_disconnect (uc->client, GNUNET_NO);
500 return; 522 uc->client = NULL;
523 }
524 if (NULL != uc->dsh)
525 {
526 GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
527 uc->dsh = NULL;
528 }
529 if (NULL != uc->tc)
530 {
531 GNUNET_FS_tree_encoder_finish (uc->tc,
532 NULL,
533 NULL);
534 uc->tc = NULL;
535 }
536 if (uc->fh != NULL)
537 {
538 GNUNET_DISK_file_close (uc->fh);
539 uc->fh = NULL;
501 } 540 }
541 GNUNET_FS_end_top (uc->h, uc->top);
502 if (uc->serialization != NULL) 542 if (uc->serialization != NULL)
503 { 543 {
504 GNUNET_FS_remove_sync_file_ (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, uc->serialization); 544 GNUNET_FS_remove_sync_file_ (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, uc->serialization);
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c
index c964004c1..2185be21d 100644
--- a/src/fs/test_fs_unindex_persistence.c
+++ b/src/fs/test_fs_unindex_persistence.c
@@ -161,7 +161,6 @@ progress_cb (void *cls,
161 GNUNET_assert (unindex != NULL); 161 GNUNET_assert (unindex != NULL);
162 break; 162 break;
163 case GNUNET_FS_STATUS_UNINDEX_COMPLETED: 163 case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
164 consider_restart (event->status);
165 printf ("Unindex complete, %llu kbps.\n", 164 printf ("Unindex complete, %llu kbps.\n",
166 (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).value) / 1024)); 165 (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).value) / 1024));
167 GNUNET_SCHEDULER_add_continuation (sched, 166 GNUNET_SCHEDULER_add_continuation (sched,
@@ -180,6 +179,25 @@ progress_cb (void *cls,
180 (unsigned long long) event->value.unindex.specifics.progress.offset); 179 (unsigned long long) event->value.unindex.specifics.progress.offset);
181#endif 180#endif
182 break; 181 break;
182 case GNUNET_FS_STATUS_PUBLISH_SUSPEND:
183 if (event->value.publish.sc == publish)
184 publish = NULL;
185 break;
186 case GNUNET_FS_STATUS_PUBLISH_RESUME:
187 if (NULL == publish)
188 {
189 publish = event->value.publish.sc;
190 return "publish-context";
191 }
192 break;
193 case GNUNET_FS_STATUS_UNINDEX_SUSPEND:
194 GNUNET_assert (event->value.unindex.uc == unindex);
195 unindex = NULL;
196 break;
197 case GNUNET_FS_STATUS_UNINDEX_RESUME:
198 GNUNET_assert (NULL == unindex);
199 unindex = event->value.unindex.uc;
200 return "unindex";
183 case GNUNET_FS_STATUS_PUBLISH_ERROR: 201 case GNUNET_FS_STATUS_PUBLISH_ERROR:
184 fprintf (stderr, 202 fprintf (stderr,
185 "Error publishing file: %s\n", 203 "Error publishing file: %s\n",
@@ -222,7 +240,6 @@ progress_cb (void *cls,
222 GNUNET_assert (0 == event->value.unindex.completed); 240 GNUNET_assert (0 == event->value.unindex.completed);
223 break; 241 break;
224 case GNUNET_FS_STATUS_UNINDEX_STOPPED: 242 case GNUNET_FS_STATUS_UNINDEX_STOPPED:
225 consider_restart (event->status);
226 GNUNET_assert (unindex == event->value.unindex.uc); 243 GNUNET_assert (unindex == event->value.unindex.uc);
227 GNUNET_SCHEDULER_add_continuation (sched, 244 GNUNET_SCHEDULER_add_continuation (sched,
228 &abort_publish_task, 245 &abort_publish_task,