From: Christian Grothoff Date: Thu, 31 Mar 2011 13:21:24 +0000 (+0000) Subject: fixes X-Git-Tag: initial-import-from-subversion-38251~18850 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=672d4cc8c0d9d2f7420e837511bffac88777345b;p=oweals%2Fgnunet.git fixes --- diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 49d424825..94970019f 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -217,6 +217,7 @@ endif test_fs_directory_SOURCES = \ test_fs_directory.c test_fs_directory_LDADD = \ + -lextractor \ $(top_builddir)/src/fs/libgnunetfs.la \ $(top_builddir)/src/util/libgnunetutil.la @@ -241,6 +242,7 @@ test_fs_download_persistence_LDADD = \ test_fs_file_information_SOURCES = \ test_fs_file_information.c test_fs_file_information_LDADD = \ + -lextractor \ $(top_builddir)/src/fs/libgnunetfs.la \ $(top_builddir)/src/util/libgnunetutil.la @@ -342,6 +344,7 @@ perf_gnunet_service_fs_p2p_SOURCES = \ perf_gnunet_service_fs_p2p.c perf_gnunet_service_fs_p2p_LDADD = \ $(top_builddir)/src/fs/libgnunetfstest.a \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/fs/libgnunetfs.la \ $(top_builddir)/src/util/libgnunetutil.la @@ -350,6 +353,7 @@ perf_gnunet_service_fs_p2p_index_SOURCES = \ perf_gnunet_service_fs_p2p.c perf_gnunet_service_fs_p2p_index_LDADD = \ $(top_builddir)/src/fs/libgnunetfstest.a \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/fs/libgnunetfs.la \ $(top_builddir)/src/util/libgnunetutil.la @@ -358,6 +362,7 @@ perf_gnunet_service_fs_p2p_dht_SOURCES = \ perf_gnunet_service_fs_p2p.c perf_gnunet_service_fs_p2p_dht_LDADD = \ $(top_builddir)/src/fs/libgnunetfstest.a \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/fs/libgnunetfs.la \ $(top_builddir)/src/util/libgnunetutil.la @@ -366,6 +371,7 @@ perf_gnunet_service_fs_p2p_trust_SOURCES = \ perf_gnunet_service_fs_p2p_trust.c perf_gnunet_service_fs_p2p_trust_LDADD = \ $(top_builddir)/src/fs/libgnunetfstest.a \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/fs/libgnunetfs.la \ $(top_builddir)/src/util/libgnunetutil.la diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 22fdd2141..8192b8c1f 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -97,38 +97,6 @@ compute_disk_offset (uint64_t fsize, } -/** - * Given a block at the given offset and depth, calculate the offset - * for the CHK at the given index. - * - * @param offset the offset of the first - * DBLOCK in the subtree of the - * identified IBLOCK - * @param depth the depth of the IBLOCK in the tree, 0 for DBLOCK - * @param k which CHK in the IBLOCK are we - * talking about - * @return offset if k=0, otherwise an appropriately - * larger value (i.e., if depth = 1, - * the returned value should be offset+k*DBLOCK_SIZE) - */ -static uint64_t -compute_dblock_offset (uint64_t offset, - unsigned int depth, - unsigned int k) -{ - unsigned int i; - uint64_t lsize; /* what is the size of the sum of all DBlocks - that a CHK at depth i corresponds to? */ - - if (depth == 0) - return offset; - lsize = DBLOCK_SIZE; - for (i=1;isize / sizeof(struct ContentHashKey))-1;i>=0;i--) { - off = compute_dblock_offset (dr->offset, - dr->depth, - i); drc = dr->children[i]; switch (drc->state) { diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 0452b7332..3298a5216 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -939,6 +939,18 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, (unsigned int) bm); #endif namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL; + if ( (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) && + (namespace == NULL) ) + { + GNUNET_break_op (0); + return NULL; + } + if ( (type != GNUNET_BLOCK_TYPE_FS_SBLOCK) && + (namespace != NULL) ) + { + GNUNET_break_op (0); + return NULL; + } target = (0 != (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? ((const struct GNUNET_PeerIdentity*) &opt[bits++]) : NULL; options = 0; spid = 0; diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index c193c1472..e09a8567b 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -217,7 +217,6 @@ schedule_peer_transmission (void *cls, { struct PeerPlan *pp = cls; struct GSF_RequestPlan *rp; - struct GSF_PendingRequestData *prd; size_t msize; pp->task = GNUNET_SCHEDULER_NO_TASK; @@ -226,12 +225,10 @@ schedule_peer_transmission (void *cls, while ( (NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) && (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value == 0) ) { - rp = GNUNET_CONTAINER_heap_remove_root (pp->delay_heap); + GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap)); rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority); - if (NULL == (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) - break; } if (0 == GNUNET_CONTAINER_heap_get_size (pp->priority_heap)) { @@ -247,7 +244,6 @@ schedule_peer_transmission (void *cls, /* process from priority heap */ rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); GNUNET_assert (NULL != rp); - prd = GSF_pending_request_get_data_ (rp->pr); msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL); pp->pth = GSF_peer_transmit_ (pp->cp, GNUNET_YES, diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index 65b15f356..b96ee3d1c 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c @@ -404,7 +404,6 @@ find_content (struct MigrationReadyPeer *mrp) /* failed to find migration target AND queue is full, purge most-forwarded block from queue to make room for more */ - score = 0; pos = mig_head; while (NULL != pos) {