aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-07 08:01:46 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-07 08:01:46 +0000
commitb37abd79cafa9ef6221e4d86ba426ed94b037281 (patch)
treea0706e4856e68a10f3e1e68ce659bc53e65f473c
parent2d60ec0a85a587b802c4b10c6f89f30618cdab69 (diff)
downloadgnunet-b37abd79cafa9ef6221e4d86ba426ed94b037281.tar.gz
gnunet-b37abd79cafa9ef6221e4d86ba426ed94b037281.zip
stuff
-rw-r--r--TODO8
-rw-r--r--src/block/plugin_block.h5
-rw-r--r--src/include/gnunet_block_lib.h2
-rw-r--r--src/vpn/gnunet-daemon-vpn.c82
4 files changed, 62 insertions, 35 deletions
diff --git a/TODO b/TODO
index 38393718b..46d64acce 100644
--- a/TODO
+++ b/TODO
@@ -99,6 +99,14 @@
99 - performance tests 99 - performance tests
100* BLOCK: 100* BLOCK:
101 - more testing (KBlock, SBlock, NBlock) 101 - more testing (KBlock, SBlock, NBlock)
102* FS migration:
103 - exclude content that will "soon" expire from migration?
104 - exclude content with zero-anonymity from gap migration?
105 - make migration data rate & datastore IO-rate configurable
106 - exclude certain peers as targets (based on hash values) in each
107 iteration => same peer can only be picked every n-th iteration
108 for the same content => fewer duplicate sending!
109
102 110
1030.9.1: 1110.9.1:
104* TRANSPORT: [MW] 112* 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 @@
32#include "gnunet_block_lib.h" 32#include "gnunet_block_lib.h"
33 33
34 34
35
36/** 35/**
37 * Function called to validate a reply or a request. For 36 * Function called to validate a reply or a request. For
38 * request evaluation, simply pass "NULL" for the reply_block. 37 * request evaluation, simply pass "NULL" for the reply_block.
@@ -71,7 +70,9 @@ typedef enum GNUNET_BLOCK_EvaluationResult
71 * @param block block to get the key for 70 * @param block block to get the key for
72 * @param block_size number of bytes in block 71 * @param block_size number of bytes in block
73 * @param key set to the key (query) for the given block 72 * @param key set to the key (query) for the given block
74 * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported 73 * @return GNUNET_YES on success,
74 * GNUNET_NO if the block is malformed
75 * GNUNET_SYSERR if type not supported
75 * (or if extracting a key from a block of this type does not work) 76 * (or if extracting a key from a block of this type does not work)
76 */ 77 */
77typedef int 78typedef 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,
219 * @param block block to get the key for 219 * @param block block to get the key for
220 * @param block_size number of bytes in block 220 * @param block_size number of bytes in block
221 * @param key set to the key (query) for the given block 221 * @param key set to the key (query) for the given block
222 * @return GNUNET_OK on success, 222 * @return GNUNET_YES on success,
223 * GNUNET_NO if the block is malformed 223 * GNUNET_NO if the block is malformed
224 * GNUNET_SYSERR if type not supported 224 * GNUNET_SYSERR if type not supported
225 * (or if extracting a key from a block of this type does not work) 225 * (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 {
68static struct vpn_cls mycls; 68static struct vpn_cls mycls;
69 69
70static void cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { 70static void cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) {
71 if (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) { 71 GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
72 PLIBC_KILL(mycls.helper_pid, SIGTERM); 72 PLIBC_KILL(mycls.helper_pid, SIGTERM);
73 GNUNET_OS_process_wait(mycls.helper_pid); 73 GNUNET_OS_process_wait(mycls.helper_pid);
74 } 74 if (mycls.dns_connection != NULL)
75 {
76 GNUNET_CLIENT_disconnect (mycls.dns_connection);
77 mycls.dns_connection = NULL;
78 }
75} 79}
76 80
77static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx); 81static 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
256 260
257} 261}
258 262
259void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg); 263static void
260 264dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg);
261void reconnect_to_service_dns() { 265
262 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n"); 266static void
263 if (mycls.dns_connection != NULL) { 267reconnect_to_service_dns (void *cls,
264 GNUNET_CLIENT_disconnect(mycls.dns_connection, 1); 268 const struct GNUNET_SCHEDULER_TaskContext *tc) {
265 } 269 if (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
266 mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg); 270 return;
267 271 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n");
268 GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); 272 GNUNET_assert (mycls.dns_connection == NULL);
273 mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg);
274 GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL);
269} 275}
270 276
271void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { 277static void
272 if (msg == NULL) return reconnect_to_service_dns(); 278dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg)
273 279{
274 if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto out; 280 if (msg == NULL)
275 281 {
276 struct answer_packet_list* pkt = GNUNET_malloc(ntohs(msg->size) + 2*sizeof(struct answer_packet_list*)); 282 GNUNET_CLIENT_disconnect(mycls.dns_connection, GNUNET_NO);
277 283 mycls.dns_connection = NULL;
278 memcpy(&pkt->pkt, msg, ntohs(msg->size)); 284 GNUNET_SCHEDULER_add_delayed (mycls.sched,
279 285 GNUNET_TIME_UNIT_SECONDS,
280 GNUNET_CONTAINER_DLL_insert_after(mycls.answer_head, mycls.answer_tail, mycls.answer_tail, pkt); 286 &reconnect_to_service_dns,
281 287 NULL);
282 GNUNET_SCHEDULER_add_write_file (mycls.sched, GNUNET_TIME_UNIT_FOREVER_REL, mycls.fh_to_helper, &helper_write, NULL); 288 return;
289 }
283 290
284out: 291 if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS))
285 GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); 292 {
293 GNUNET_break (0);
294 GNUNET_CLIENT_disconnect(mycls.dns_connection, GNUNET_NO);
295 mycls.dns_connection = NULL;
296 GNUNET_SCHEDULER_add_now (mycls.sched,
297 &reconnect_to_service_dns,
298 NULL);
299 return;
300 }
301 struct answer_packet_list* pkt = GNUNET_malloc(ntohs(msg->size) + 2*sizeof(struct answer_packet_list*));
302
303 memcpy(&pkt->pkt, msg, ntohs(msg->size));
304 GNUNET_CONTAINER_DLL_insert_after(mycls.answer_head, mycls.answer_tail, mycls.answer_tail, pkt);
305 GNUNET_SCHEDULER_add_write_file (mycls.sched, GNUNET_TIME_UNIT_FOREVER_REL, mycls.fh_to_helper, &helper_write, NULL);
306 GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL);
286} 307}
287 308
288/** 309/**
@@ -303,11 +324,8 @@ run (void *cls,
303{ 324{
304 mycls.sched = sched; 325 mycls.sched = sched;
305 mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL); 326 mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL);
306
307 mycls.cfg = cfg; 327 mycls.cfg = cfg;
308 328 GNUNET_SCHEDULER_add_now (sched, &reconnect_to_service_dns, NULL);
309 reconnect_to_service_dns();
310
311 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); 329 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
312 start_helper_and_schedule(mycls); 330 start_helper_and_schedule(mycls);
313} 331}