#include "fs.h"
#include "fs_tree.h"
-#define DEBUG_DOWNLOAD GNUNET_NO
+#define DEBUG_DOWNLOAD GNUNET_YES
/**
* We're storing the IBLOCKS after the
unsigned int treedepth)
{
unsigned int i;
- uint64_t lsize; /* what is the size of all IBlocks for level "i"? */
- uint64_t loff; /* where do IBlocks for level "i" start? */
- unsigned int ioff; /* which IBlock corresponds to "off" at level "i"? */
+ uint64_t lsize; /* what is the size of all IBlocks for depth "i"? */
+ uint64_t loff; /* where do IBlocks for depth "i" start? */
+ unsigned int ioff; /* which IBlock corresponds to "off" at depth "i"? */
if (depth == treedepth)
return off;
{
unsigned int i;
uint64_t lsize; /* what is the size of the sum of all DBlocks
- that a CHK at level i corresponds to? */
+ that a CHK at depth i corresponds to? */
if (depth == treedepth)
return offset;
}
#if DEBUG_DOWNLOAD
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Triggering downloads of children (this block was at level %u and offset %llu)\n",
+ "Triggering downloads of children (this block was at depth %u and offset %llu)\n",
sm->depth,
(unsigned long long) sm->offset);
#endif
GNUNET_free (dc);
}
-
-
-#if 0
-
-
-/**
- * Check if self block is already present on the drive. If the block
- * is a dblock and present, the ProgressModel is notified. If the
- * block is present and it is an iblock, downloading the children is
- * triggered.
- *
- * Also checks if the block is within the range of blocks
- * that we are supposed to download. If not, the method
- * returns as if the block is present but does NOT signal
- * progress.
- *
- * @param node that is checked for presence
- * @return GNUNET_YES if present, GNUNET_NO if not.
- */
-static int
-check_node_present (const struct Node *node)
-{
- int res;
- int ret;
- char *data;
- unsigned int size;
- GNUNET_HashCode hc;
-
- size = get_node_size (node);
- /* first check if node is within range.
- For now, keeping it simple, we only do
- this for level-0 nodes */
- if ((node->level == 0) &&
- ((node->offset + size < node->ctx->offset) ||
- (node->offset >= node->ctx->offset + node->ctx->length)))
- return GNUNET_YES;
- data = GNUNET_malloc (size);
- ret = GNUNET_NO;
- res = read_from_files (node->ctx, node->level, node->offset, data, size);
- if (res == size)
- {
- GNUNET_hash (data, size, &hc);
- if (0 == memcmp (&hc, &node->chk.key, sizeof (GNUNET_HashCode)))
- {
- notify_client_about_progress (node, data, size);
- if (node->level > 0)
- iblock_download_children (node, data, size);
- ret = GNUNET_YES;
- }
- }
- GNUNET_free (data);
- return ret;
-}
-
-#endif
-
-
/* end of fs_download.c */
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"unlink",
fi->serialization);
- GNUNET_FS_uri_destroy (fi->keywords);
+ if (NULL != fi->keywords)
+ GNUNET_FS_uri_destroy (fi->keywords);
GNUNET_CONTAINER_meta_data_destroy (fi->meta);
GNUNET_free_non_null (fi->serialization);
if (fi->te != NULL)
/**
- * We've finished publishing a KBlock
- * as part of a larger upload. Check
- * the result and continue the larger
- * upload.
+ * We've finished publishing a KBlock as part of a larger upload.
+ * Check the result and continue the larger upload.
*
* @param cls the "struct GNUNET_FS_PublishContext*"
* of the larger upload
if (NULL != p->chk_uri)
{
/* upload of "p" complete, publish KBlocks! */
- GNUNET_FS_publish_ksk (sc->h,
- p->keywords,
- p->meta,
- p->chk_uri,
- p->expirationTime,
- p->anonymity,
- p->priority,
- sc->options,
- &publish_kblocks_cont,
- sc);
+ if (p->keywords != NULL)
+ {
+ GNUNET_FS_publish_ksk (sc->h,
+ p->keywords,
+ p->meta,
+ p->chk_uri,
+ p->expirationTime,
+ p->anonymity,
+ p->priority,
+ sc->options,
+ &publish_kblocks_cont,
+ sc);
+ }
+ else
+ {
+ publish_kblocks_cont (sc,
+ p->chk_uri,
+ NULL);
+ }
return;
}
if ( (!p->is_directory) &&
#include "gnunet-service-fs_indexing.h"
#include "fs.h"
-#define DEBUG_FS GNUNET_NO
+#define DEBUG_FS GNUNET_YES
/**
* Maximum number of outgoing messages we queue per peer.
[transport]
PORT = 43465
PLUGINS = tcp
+#DEBUG = YES
[arm]
PORT = 43466
HOSTNAME = localhost
-DEFAULTSERVICES = resolver datastore transport core fs
+DEFAULTSERVICES = resolver datastore transport core fs peerinfo
[datastore]
#DEBUG = YES
[transport-tcp]
ALLOW_SHUTDOWN = NO
TIMEOUT = 300000
-PORT = 43468
+#PORT = 43468
[peerinfo]
PORT = 43469
[core]
PORT = 43470
HOSTNAME = localhost
+#DEBUG = YES
[fs]
PORT = 43471
HOSTNAME = localhost
-#DEBUG = YES
-#PREFIX = valgrind --tool=memcheck --leak-check=yes
+DEBUG = YES
+PREFIX = valgrind --tool=memcheck --leak-check=yes
#BINARY = /home/grothoff/bin/gnunet-service-fs
[testing]
#include "platform.h"
#include "test_fs_lib.h"
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
/**
* File-size we use for testing.
"Downloading %llu bytes\n",
(unsigned long long) FILESIZE);
GNUNET_FS_TEST_download (sched,
- daemons[1],
+ daemons[0],
TIMEOUT,
1, SEED, uri,
VERBOSE,
"Publishing %llu bytes\n",
(unsigned long long) FILESIZE);
GNUNET_FS_TEST_publish (sched,
- daemons[1],
+ daemons[0],
TIMEOUT,
1, GNUNET_NO, FILESIZE, SEED,
VERBOSE,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Daemons started, will now try to connect them\n");
GNUNET_FS_TEST_daemons_connect (sched,
daemons[0],
daemons[1],
GNUNET_GETOPT_OPTION_END
};
+ GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
GNUNET_log_setup ("test_gnunet_service_fs_p2p",
#if VERBOSE
"DEBUG",
GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
argvx, "test-gnunet-service-fs-p2p",
"nohelp", options, &run, NULL);
+ GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
return 0;
}
#include "gnunet_testing_lib.h"
#include "gnunet_transport_service.h"
-#define DEBUG_TESTING GNUNET_YES
+#define DEBUG_TESTING GNUNET_NO
/**
* How long do we wait after starting gnunet-service-arm
if (ctx->hello != NULL)
{
GNUNET_TRANSPORT_offer_hello (ctx->d2th, ctx->hello);
- ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 200));
+ ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello,
+ GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS,
+ 200));
}
-
- ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, ctx->timeout_hello, &send_hello, ctx);
+ ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched,
+ ctx->timeout_hello,
+ &send_hello, ctx);
}
¬ify_connect_result, ctx);
GNUNET_TRANSPORT_get_hello (ctx->d1th, &process_hello, ctx);
- ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, ctx->timeout_hello, &send_hello, ctx);
+ ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, ctx->timeout_hello,
+ &send_hello, ctx);
}
{
int ret;
-#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' request from client\n", "HELLO");
-#endif
ret = process_hello (NULL, message);
GNUNET_SERVER_receive_done (client, ret);
}
struct PeerEntry
{
/**
- * the identifier itself
+ * The identifier itself
*/
struct GNUNET_PeerIdentity id;
/**
- * Short version of the identifier;
- * if the RC==0, then index of next
- * free slot in table, otherwise
- * equal to this slot in the table.
+ * Short version of the identifier; if the RC==0, then index of next
+ * free slot in table, otherwise equal to this slot in the table.
*/
GNUNET_PEER_Id pid;
/**
- * Reference counter, 0 if this slot
- * is not used.
+ * Reference counter, 0 if this slot is not used.
*/
unsigned int rc;
};
for (i = count - 1; i >= 0; i--)
{
id = ids[i];
+ if (id == 0)
+ continue;
GNUNET_assert (id < size);
GNUNET_assert (table[id].rc > 0);
table[id].rc--;