summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fs/Makefile.am5
-rw-r--r--src/fs/fs_test_lib.c1
-rw-r--r--src/fs/fs_test_lib_data.conf8
-rw-r--r--src/fs/gnunet-service-fs.c53
-rw-r--r--src/fs/gnunet-service-fs_indexing.c12
-rw-r--r--src/fs/test_fs_list_indexed_data.conf2
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c2
7 files changed, 57 insertions, 26 deletions
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 6c850a91d..f287b6b31 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -143,7 +143,7 @@ check_SCRIPTS = \
143 test_gnunet_fs_idx.py 143 test_gnunet_fs_idx.py
144endif 144endif
145 145
146TESTS = $(check_SCRIPTS) \ 146TESTS = \
147 test_fs_directory \ 147 test_fs_directory \
148 test_fs_download \ 148 test_fs_download \
149 test_fs_download_persistence \ 149 test_fs_download_persistence \
@@ -159,7 +159,8 @@ TESTS = $(check_SCRIPTS) \
159 test_fs_unindex_persistence \ 159 test_fs_unindex_persistence \
160 test_fs_uri \ 160 test_fs_uri \
161 test_fs_test_lib \ 161 test_fs_test_lib \
162 test_gnunet_service_fs_p2p 162 test_gnunet_service_fs_p2p \
163 $(check_SCRIPTS)
163# $(check_PROGRAMS) 164# $(check_PROGRAMS)
164 165
165 166
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index fba44eaeb..f2fb0ab74 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -180,6 +180,7 @@ progress_cb (void *cls,
180{ 180{
181 struct GNUNET_FS_TestDaemon *daemon = cls; 181 struct GNUNET_FS_TestDaemon *daemon = cls;
182 182
183 fprintf (stderr, "PCB %d\n", info->status);
183 switch (info->status) 184 switch (info->status)
184 { 185 {
185 case GNUNET_FS_STATUS_PUBLISH_COMPLETED: 186 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf
index 3f00352a7..ffe78fbb1 100644
--- a/src/fs/fs_test_lib_data.conf
+++ b/src/fs/fs_test_lib_data.conf
@@ -22,7 +22,6 @@ DEFAULTSERVICES = fs
22[datastore] 22[datastore]
23#DEBUG = YES 23#DEBUG = YES
24#PREFIX = valgrind --tool=memcheck --leak-check=yes 24#PREFIX = valgrind --tool=memcheck --leak-check=yes
25#BINARY = /home/grothoff/bin/gnunet-service-datastore
26 25
27[statistics] 26[statistics]
28PORT = 43467 27PORT = 43467
@@ -31,7 +30,6 @@ HOSTNAME = localhost
31[transport-tcp] 30[transport-tcp]
32TIMEOUT = 300000 31TIMEOUT = 300000
33#PORT = 43468 32#PORT = 43468
34#DEBUG = YES
35 33
36[peerinfo] 34[peerinfo]
37PORT = 43469 35PORT = 43469
@@ -51,10 +49,10 @@ TOTAL_QUOTA_OUT = 3932160
51[fs] 49[fs]
52PORT = 43471 50PORT = 43471
53HOSTNAME = localhost 51HOSTNAME = localhost
54#OPTIONS = -L DEBUG 52OPTIONS = -L DEBUG
55#DEBUG = YES 53#DEBUG = YES
56PREFIX = valgrind --tool=memcheck --leak-check=yes 54#PREFIX = valgrind --tool=memcheck --leak-check=yes
57#BINARY = /home/grothoff/bin/gnunet-service-fs 55BINARY = /home/grothoff/bin/gnunet-service-fs
58#PREFIX = xterm -e gdb -x cmd --args 56#PREFIX = xterm -e gdb -x cmd --args
59 57
60[testing] 58[testing]
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index fb5b9c84c..a183336ee 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -44,7 +44,7 @@
44#include "gnunet-service-fs_indexing.h" 44#include "gnunet-service-fs_indexing.h"
45#include "fs.h" 45#include "fs.h"
46 46
47#define DEBUG_FS GNUNET_NO 47#define DEBUG_FS GNUNET_YES
48 48
49/** 49/**
50 * Maximum number of outgoing messages we queue per peer. 50 * Maximum number of outgoing messages we queue per peer.
@@ -936,6 +936,10 @@ process_migration_content (void *cls,
936 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 936 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
937 return; 937 return;
938 } 938 }
939 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
940 "Retrieved block `%s' of type %u for migration\n",
941 GNUNET_h2s (key),
942 type);
939 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size); 943 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size);
940 mb->query = *key; 944 mb->query = *key;
941 mb->expiration = expiration; 945 mb->expiration = expiration;
@@ -1509,7 +1513,7 @@ transmit_to_peer (void *cls,
1509 &pid.hashPubKey, 1513 &pid.hashPubKey,
1510 cp); 1514 cp);
1511 } 1515 }
1512#if DEBUG_FS 1516#if DEBUG_FS > 3
1513 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1514 "Transmitting %u bytes to peer %u\n", 1518 "Transmitting %u bytes to peer %u\n",
1515 msize, 1519 msize,
@@ -2260,6 +2264,11 @@ struct ProcessReplyClosure
2260 * How much was this reply worth to us? 2264 * How much was this reply worth to us?
2261 */ 2265 */
2262 uint32_t priority; 2266 uint32_t priority;
2267
2268 /**
2269 * Did we finish processing the associated request?
2270 */
2271 int finished;
2263}; 2272};
2264 2273
2265 2274
@@ -2420,7 +2429,7 @@ process_reply (void *cls,
2420 } 2429 }
2421 prq->priority += pr->remaining_priority; 2430 prq->priority += pr->remaining_priority;
2422 pr->remaining_priority = 0; 2431 pr->remaining_priority = 0;
2423 if (pr->client_request_list != NULL) 2432 if (NULL != pr->client_request_list)
2424 { 2433 {
2425 GNUNET_STATISTICS_update (stats, 2434 GNUNET_STATISTICS_update (stats,
2426 gettext_noop ("# replies received for local clients"), 2435 gettext_noop ("# replies received for local clients"),
@@ -2456,7 +2465,10 @@ process_reply (void *cls,
2456 } 2465 }
2457 GNUNET_break (cl->th != NULL); 2466 GNUNET_break (cl->th != NULL);
2458 if (pr->do_remove) 2467 if (pr->do_remove)
2459 destroy_pending_request (pr); 2468 {
2469 prq->finished = GNUNET_YES;
2470 destroy_pending_request (pr);
2471 }
2460 } 2472 }
2461 else 2473 else
2462 { 2474 {
@@ -2583,12 +2595,19 @@ handle_p2p_put (void *cls,
2583 prq.type = type; 2595 prq.type = type;
2584 prq.expiration = expiration; 2596 prq.expiration = expiration;
2585 prq.priority = 0; 2597 prq.priority = 0;
2598 prq.finished = GNUNET_NO;
2586 GNUNET_CONTAINER_multihashmap_get_multiple (query_request_map, 2599 GNUNET_CONTAINER_multihashmap_get_multiple (query_request_map,
2587 &query, 2600 &query,
2588 &process_reply, 2601 &process_reply,
2589 &prq); 2602 &prq);
2590 if (GNUNET_YES == active_migration) 2603 if (GNUNET_YES == active_migration)
2591 { 2604 {
2605#if DEBUG_FS
2606 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2607 "Replicating result for query `%s' with priority %u\n",
2608 GNUNET_h2s (&query),
2609 prq.priority);
2610#endif
2592 GNUNET_DATASTORE_put (dsh, 2611 GNUNET_DATASTORE_put (dsh,
2593 0, &query, dsize, &put[1], 2612 0, &query, dsize, &put[1],
2594 type, prq.priority, 1 /* anonymity */, 2613 type, prq.priority, 1 /* anonymity */,
@@ -2814,13 +2833,21 @@ process_local_reply (void *cls,
2814 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 2833 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
2815 return; 2834 return;
2816 } 2835 }
2836 prq.type = type;
2837 prq.priority = priority;
2838 prq.finished = GNUNET_NO;
2839 process_reply (&prq, key, pr);
2840 if (prq.finished == GNUNET_YES)
2841 return;
2842 if (pr->qe == NULL)
2843 return; /* done here */
2817 if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) || 2844 if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) ||
2818 (type == GNUNET_BLOCK_TYPE_IBLOCK) ) 2845 (type == GNUNET_BLOCK_TYPE_IBLOCK) )
2819 { 2846 {
2820 if (pr->qe != NULL) 2847 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
2821 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 2848 return;
2822 } 2849 }
2823 else if ( (pr->client_request_list == NULL) && 2850 if ( (pr->client_request_list == NULL) &&
2824 ( (GNUNET_YES == test_load_too_high()) || 2851 ( (GNUNET_YES == test_load_too_high()) ||
2825 (pr->results_found > 5 + 2 * pr->priority) ) ) 2852 (pr->results_found > 5 + 2 * pr->priority) ) )
2826 { 2853 {
@@ -2832,14 +2859,10 @@ process_local_reply (void *cls,
2832 gettext_noop ("# processing result set cut short due to load"), 2859 gettext_noop ("# processing result set cut short due to load"),
2833 1, 2860 1,
2834 GNUNET_NO); 2861 GNUNET_NO);
2835 if (pr->qe != NULL) 2862 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
2836 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 2863 return;
2837 } 2864 }
2838 else if (pr->qe != NULL) 2865 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
2839 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
2840 prq.type = type;
2841 prq.priority = priority;
2842 process_reply (&prq, key, pr);
2843} 2866}
2844 2867
2845 2868
@@ -3062,7 +3085,7 @@ handle_p2p_get (void *cls,
3062 gettext_noop ("# requests dropped due TTL underflow"), 3085 gettext_noop ("# requests dropped due TTL underflow"),
3063 1, 3086 1,
3064 GNUNET_NO); 3087 GNUNET_NO);
3065 /* integer underflow => drop (should be very rare)! */ 3088 /* integer underflow => drop (should be very rare)! */
3066 GNUNET_free (pr); 3089 GNUNET_free (pr);
3067 return GNUNET_OK; 3090 return GNUNET_OK;
3068 } 3091 }
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index 6c44f8e2f..39999be75 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -40,7 +40,7 @@
40#include "gnunet-service-fs_indexing.h" 40#include "gnunet-service-fs_indexing.h"
41#include "fs.h" 41#include "fs.h"
42 42
43#define DEBUG_FS GNUNET_NO 43#define DEBUG_FS GNUNET_YES
44 44
45/** 45/**
46 * In-memory information about indexed files (also available 46 * In-memory information about indexed files (also available
@@ -367,6 +367,13 @@ GNUNET_FS_handle_index_start (void *cls,
367 ii->filename = (const char*) &ii[1]; 367 ii->filename = (const char*) &ii[1];
368 memcpy (&ii[1], fn, slen); 368 memcpy (&ii[1], fn, slen);
369 ii->file_id = ism->file_id; 369 ii->file_id = ism->file_id;
370#if DEBUG_FS
371 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
372 "Received `%s' message for file `%s'\n",
373 "START_INDEX",
374 ii->filename);
375#endif
376
370 ii->tc = GNUNET_SERVER_transmit_context_create (client); 377 ii->tc = GNUNET_SERVER_transmit_context_create (client);
371 mydev = 0; 378 mydev = 0;
372 myino = 0; 379 myino = 0;
@@ -610,8 +617,9 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
610 sizeof (ndata)))) ) 617 sizeof (ndata)))) )
611 { 618 {
612 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 619 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
613 _("Could not access indexed file `%s' at offset %llu: %s\n"), 620 _("Could not access indexed file `%s' (%s) at offset %llu: %s\n"),
614 GNUNET_h2s (&odb->file_id), 621 GNUNET_h2s (&odb->file_id),
622 fn,
615 (unsigned long long) off, 623 (unsigned long long) off,
616 STRERROR (errno)); 624 STRERROR (errno));
617 if (fh != NULL) 625 if (fh != NULL)
diff --git a/src/fs/test_fs_list_indexed_data.conf b/src/fs/test_fs_list_indexed_data.conf
index 9f717b2e0..84a03a3c0 100644
--- a/src/fs/test_fs_list_indexed_data.conf
+++ b/src/fs/test_fs_list_indexed_data.conf
@@ -36,7 +36,7 @@ HOSTNAME = localhost
36[fs] 36[fs]
37PORT = 42471 37PORT = 42471
38HOSTNAME = localhost 38HOSTNAME = localhost
39#DEBUG = YES 39# DEBUG = YES
40 40
41[testing] 41[testing]
42WEAKRANDOM = YES 42WEAKRANDOM = YES
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 7e3e02c76..92ac44dcc 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -26,7 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "fs_test_lib.h" 27#include "fs_test_lib.h"
28 28
29#define VERBOSE GNUNET_NO 29#define VERBOSE GNUNET_YES
30 30
31/** 31/**
32 * File-size we use for testing. 32 * File-size we use for testing.