From 29420025183ad85f50b82b0da5ba108df12644d7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 10 Jul 2010 14:30:47 +0000 Subject: [PATCH] unindex on failure, location URI support --- TODO | 2 -- src/fs/fs_download.c | 1 - src/fs/fs_publish.c | 34 +++++++++++++++++++++++++++++----- src/fs/gnunet-service-fs.c | 3 +++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 1188de845..bd22ce3b6 100644 --- a/TODO +++ b/TODO @@ -18,14 +18,12 @@ - implement performance tests * FS: [CG] - trust: do not charge when "idle" / load considerations (migration, routing) - - unindex on index failure - listing of learned namespaces - artificial delays - active reply route caching design & implementation of service; gap extension! - utilize in-line files in meta data always (including in search results or when download is triggered manually and for probes); currently the data is only used when users do a general 'recursive' download - - location URIs (publish, search, download) - non-anonymous FS service (needs DHT) + DHT integration for search + CS-DHT-functions (DHT-put of LOC) diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 53bad3126..f1897e65f 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -23,7 +23,6 @@ * @author Christian Grothoff * * TODO: - * - location URI suppport (can wait, easy) * - different priority for scheduling probe downloads? * - check if iblocks can be computed from existing blocks (can wait, hard) */ diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index bd5a9ebd6..a19538345 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -24,11 +24,6 @@ * @see http://gnunet.org/encoding * @author Krista Bennett * @author Christian Grothoff - * - * TODO: - * - indexing cleanup: unindex on failure (can wait) - * - datastore reservation support (optimization) - * - location URIs (publish with anonymity-level zero) */ #include "platform.h" @@ -172,6 +167,15 @@ ds_put_cont (void *cls, pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; pi.value.publish.specifics.error.message = pcc->p->emsg; pcc->p->client_info = GNUNET_FS_publish_make_status_ (&pi, pcc->sc, pcc->p, 0); + if ( (pcc->p->is_directory == GNUNET_NO) && + (pcc->p->filename != NULL) && + (pcc->p->data.do_index == GNUNET_YES) ) + { + /* run unindex to clean up */ + GNUNET_FS_unindex_start (pcc->sc->h, + pcc->p->filename, + NULL); + } } if (NULL != pcc->cont) pcc->sc->upload_task @@ -226,6 +230,16 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p, pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; pi.value.publish.specifics.error.message =emsg; p->client_info = GNUNET_FS_publish_make_status_ (&pi, sc, p, 0); + if ( (p->is_directory == GNUNET_NO) && + (p->filename != NULL) && + (p->data.do_index == GNUNET_YES) ) + { + /* run unindex to clean up */ + GNUNET_FS_unindex_start (pc->h, + p->filename, + NULL); + } + } @@ -883,6 +897,7 @@ GNUNET_FS_publish_main_ (void *cls, struct GNUNET_FS_PublishContext *pc = cls; struct GNUNET_FS_ProgressInfo pi; struct GNUNET_FS_FileInformation *p; + struct GNUNET_FS_Uri *loc; char *fn; pc->upload_task = GNUNET_SCHEDULER_NO_TASK; @@ -954,6 +969,15 @@ GNUNET_FS_publish_main_ (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "File upload complete, now publishing KSK blocks.\n"); #endif + if (0 == p->anonymity) + { + /* zero anonymity, box CHK URI in LOC URI */ + loc = GNUNET_FS_uri_loc_create (p->chk_uri, + pc->h->cfg, + p->expirationTime); + GNUNET_FS_uri_destroy (p->chk_uri); + p->chk_uri = loc; + } GNUNET_FS_publish_sync_ (pc); /* upload of "p" complete, publish KBlocks! */ if (p->keywords != NULL) diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index b3f14896b..2157ff5f5 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -2213,6 +2213,9 @@ target_peer_select_cb (void *cls, /* 3e) include peer proximity */ score -= (2.0 * (GNUNET_CRYPTO_hash_distance_u32 (key, &pr->query)) / (double) UINT32_MAX); + /* 4) super-bonus for being the known target */ + if (pr->target_pid == cp->pid) + score += 100.0; /* store best-fit in closure */ #if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, -- 2.25.1