From: Christian Grothoff Date: Thu, 7 Oct 2010 08:01:46 +0000 (+0000) Subject: stuff X-Git-Tag: initial-import-from-subversion-38251~20146 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b37abd79cafa9ef6221e4d86ba426ed94b037281;p=oweals%2Fgnunet.git stuff --- diff --git a/TODO b/TODO index 38393718b..46d64acce 100644 --- a/TODO +++ b/TODO @@ -99,6 +99,14 @@ - performance tests * BLOCK: - more testing (KBlock, SBlock, NBlock) +* FS migration: + - exclude content that will "soon" expire from migration? + - exclude content with zero-anonymity from gap migration? + - make migration data rate & datastore IO-rate configurable + - exclude certain peers as targets (based on hash values) in each + iteration => same peer can only be picked every n-th iteration + for the same content => fewer duplicate sending! + 0.9.1: * TRANSPORT: [MW] diff --git a/src/block/plugin_block.h b/src/block/plugin_block.h index 671f83aad..e0a323d25 100644 --- a/src/block/plugin_block.h +++ b/src/block/plugin_block.h @@ -32,7 +32,6 @@ #include "gnunet_block_lib.h" - /** * Function called to validate a reply or a request. For * request evaluation, simply pass "NULL" for the reply_block. @@ -71,7 +70,9 @@ typedef enum GNUNET_BLOCK_EvaluationResult * @param block block to get the key for * @param block_size number of bytes in block * @param key set to the key (query) for the given block - * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported + * @return GNUNET_YES on success, + * GNUNET_NO if the block is malformed + * GNUNET_SYSERR if type not supported * (or if extracting a key from a block of this type does not work) */ typedef int diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index d05cab2b6..d0eb0d5fa 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h @@ -219,7 +219,7 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, * @param block block to get the key for * @param block_size number of bytes in block * @param key set to the key (query) for the given block - * @return GNUNET_OK on success, + * @return GNUNET_YES on success, * GNUNET_NO if the block is malformed * GNUNET_SYSERR if type not supported * (or if extracting a key from a block of this type does not work) diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 5660aff7b..dbce0a86a 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c @@ -68,10 +68,14 @@ struct vpn_cls { static struct vpn_cls mycls; static void cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { - if (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) { - PLIBC_KILL(mycls.helper_pid, SIGTERM); - GNUNET_OS_process_wait(mycls.helper_pid); - } + GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); + PLIBC_KILL(mycls.helper_pid, SIGTERM); + GNUNET_OS_process_wait(mycls.helper_pid); + if (mycls.dns_connection != NULL) + { + GNUNET_CLIENT_disconnect (mycls.dns_connection); + mycls.dns_connection = NULL; + } } static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx); @@ -256,33 +260,50 @@ static void message_token(void *cls, void *client, const struct GNUNET_MessageHe } -void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg); - -void reconnect_to_service_dns() { - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n"); - if (mycls.dns_connection != NULL) { - GNUNET_CLIENT_disconnect(mycls.dns_connection, 1); - } - mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg); - - GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); +static void +dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg); + +static void +reconnect_to_service_dns (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) { + if (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) + return; + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n"); + GNUNET_assert (mycls.dns_connection == NULL); + mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg); + GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); } -void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { - if (msg == NULL) return reconnect_to_service_dns(); - - if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto out; - - struct answer_packet_list* pkt = GNUNET_malloc(ntohs(msg->size) + 2*sizeof(struct answer_packet_list*)); - - memcpy(&pkt->pkt, msg, ntohs(msg->size)); - - GNUNET_CONTAINER_DLL_insert_after(mycls.answer_head, mycls.answer_tail, mycls.answer_tail, pkt); - - GNUNET_SCHEDULER_add_write_file (mycls.sched, GNUNET_TIME_UNIT_FOREVER_REL, mycls.fh_to_helper, &helper_write, NULL); +static void +dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) +{ + if (msg == NULL) + { + GNUNET_CLIENT_disconnect(mycls.dns_connection, GNUNET_NO); + mycls.dns_connection = NULL; + GNUNET_SCHEDULER_add_delayed (mycls.sched, + GNUNET_TIME_UNIT_SECONDS, + &reconnect_to_service_dns, + NULL); + return; + } -out: - GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); + if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) + { + GNUNET_break (0); + GNUNET_CLIENT_disconnect(mycls.dns_connection, GNUNET_NO); + mycls.dns_connection = NULL; + GNUNET_SCHEDULER_add_now (mycls.sched, + &reconnect_to_service_dns, + NULL); + return; + } + struct answer_packet_list* pkt = GNUNET_malloc(ntohs(msg->size) + 2*sizeof(struct answer_packet_list*)); + + memcpy(&pkt->pkt, msg, ntohs(msg->size)); + GNUNET_CONTAINER_DLL_insert_after(mycls.answer_head, mycls.answer_tail, mycls.answer_tail, pkt); + GNUNET_SCHEDULER_add_write_file (mycls.sched, GNUNET_TIME_UNIT_FOREVER_REL, mycls.fh_to_helper, &helper_write, NULL); + GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); } /** @@ -303,11 +324,8 @@ run (void *cls, { mycls.sched = sched; mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL); - mycls.cfg = cfg; - - reconnect_to_service_dns(); - + GNUNET_SCHEDULER_add_now (sched, &reconnect_to_service_dns, NULL); GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); start_helper_and_schedule(mycls); }