diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-02-19 15:45:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-02-19 15:45:16 +0000 |
commit | f06ca9dcef0d602baa3a7c6462baff0dd70b2e4a (patch) | |
tree | 15c1c396a15e02477da883c2d8670ca74883f754 | |
parent | e1fe5a5ca9711cb615e4c85daf002364592814b9 (diff) | |
download | gnunet-f06ca9dcef0d602baa3a7c6462baff0dd70b2e4a.tar.gz gnunet-f06ca9dcef0d602baa3a7c6462baff0dd70b2e4a.zip |
debugging
-rw-r--r-- | src/fs/fs_download.c | 69 | ||||
-rw-r--r-- | src/fs/fs_file_information.c | 3 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 35 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 2 | ||||
-rw-r--r-- | src/fs/test_fs_lib_data.conf | 10 | ||||
-rw-r--r-- | src/fs/test_gnunet_service_fs_p2p.c | 10 | ||||
-rw-r--r-- | src/testing/testing.c | 14 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 4 | ||||
-rw-r--r-- | src/util/peer.c | 13 |
9 files changed, 58 insertions, 102 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 289599471..1399cf8dd 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "fs.h" | 36 | #include "fs.h" |
37 | #include "fs_tree.h" | 37 | #include "fs_tree.h" |
38 | 38 | ||
39 | #define DEBUG_DOWNLOAD GNUNET_NO | 39 | #define DEBUG_DOWNLOAD GNUNET_YES |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * We're storing the IBLOCKS after the | 42 | * We're storing the IBLOCKS after the |
@@ -65,9 +65,9 @@ compute_disk_offset (uint64_t fsize, | |||
65 | unsigned int treedepth) | 65 | unsigned int treedepth) |
66 | { | 66 | { |
67 | unsigned int i; | 67 | unsigned int i; |
68 | uint64_t lsize; /* what is the size of all IBlocks for level "i"? */ | 68 | uint64_t lsize; /* what is the size of all IBlocks for depth "i"? */ |
69 | uint64_t loff; /* where do IBlocks for level "i" start? */ | 69 | uint64_t loff; /* where do IBlocks for depth "i" start? */ |
70 | unsigned int ioff; /* which IBlock corresponds to "off" at level "i"? */ | 70 | unsigned int ioff; /* which IBlock corresponds to "off" at depth "i"? */ |
71 | 71 | ||
72 | if (depth == treedepth) | 72 | if (depth == treedepth) |
73 | return off; | 73 | return off; |
@@ -113,7 +113,7 @@ compute_dblock_offset (uint64_t offset, | |||
113 | { | 113 | { |
114 | unsigned int i; | 114 | unsigned int i; |
115 | uint64_t lsize; /* what is the size of the sum of all DBlocks | 115 | uint64_t lsize; /* what is the size of the sum of all DBlocks |
116 | that a CHK at level i corresponds to? */ | 116 | that a CHK at depth i corresponds to? */ |
117 | 117 | ||
118 | if (depth == treedepth) | 118 | if (depth == treedepth) |
119 | return offset; | 119 | return offset; |
@@ -504,7 +504,7 @@ process_result (struct GNUNET_FS_DownloadContext *dc, | |||
504 | } | 504 | } |
505 | #if DEBUG_DOWNLOAD | 505 | #if DEBUG_DOWNLOAD |
506 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 506 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
507 | "Triggering downloads of children (this block was at level %u and offset %llu)\n", | 507 | "Triggering downloads of children (this block was at depth %u and offset %llu)\n", |
508 | sm->depth, | 508 | sm->depth, |
509 | (unsigned long long) sm->offset); | 509 | (unsigned long long) sm->offset); |
510 | #endif | 510 | #endif |
@@ -920,61 +920,4 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | |||
920 | GNUNET_free (dc); | 920 | GNUNET_free (dc); |
921 | } | 921 | } |
922 | 922 | ||
923 | |||
924 | |||
925 | #if 0 | ||
926 | |||
927 | |||
928 | /** | ||
929 | * Check if self block is already present on the drive. If the block | ||
930 | * is a dblock and present, the ProgressModel is notified. If the | ||
931 | * block is present and it is an iblock, downloading the children is | ||
932 | * triggered. | ||
933 | * | ||
934 | * Also checks if the block is within the range of blocks | ||
935 | * that we are supposed to download. If not, the method | ||
936 | * returns as if the block is present but does NOT signal | ||
937 | * progress. | ||
938 | * | ||
939 | * @param node that is checked for presence | ||
940 | * @return GNUNET_YES if present, GNUNET_NO if not. | ||
941 | */ | ||
942 | static int | ||
943 | check_node_present (const struct Node *node) | ||
944 | { | ||
945 | int res; | ||
946 | int ret; | ||
947 | char *data; | ||
948 | unsigned int size; | ||
949 | GNUNET_HashCode hc; | ||
950 | |||
951 | size = get_node_size (node); | ||
952 | /* first check if node is within range. | ||
953 | For now, keeping it simple, we only do | ||
954 | this for level-0 nodes */ | ||
955 | if ((node->level == 0) && | ||
956 | ((node->offset + size < node->ctx->offset) || | ||
957 | (node->offset >= node->ctx->offset + node->ctx->length))) | ||
958 | return GNUNET_YES; | ||
959 | data = GNUNET_malloc (size); | ||
960 | ret = GNUNET_NO; | ||
961 | res = read_from_files (node->ctx, node->level, node->offset, data, size); | ||
962 | if (res == size) | ||
963 | { | ||
964 | GNUNET_hash (data, size, &hc); | ||
965 | if (0 == memcmp (&hc, &node->chk.key, sizeof (GNUNET_HashCode))) | ||
966 | { | ||
967 | notify_client_about_progress (node, data, size); | ||
968 | if (node->level > 0) | ||
969 | iblock_download_children (node, data, size); | ||
970 | ret = GNUNET_YES; | ||
971 | } | ||
972 | } | ||
973 | GNUNET_free (data); | ||
974 | return ret; | ||
975 | } | ||
976 | |||
977 | #endif | ||
978 | |||
979 | |||
980 | /* end of fs_download.c */ | 923 | /* end of fs_download.c */ |
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index 9c193f88b..08beff982 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -847,7 +847,8 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | |||
847 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | 847 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, |
848 | "unlink", | 848 | "unlink", |
849 | fi->serialization); | 849 | fi->serialization); |
850 | GNUNET_FS_uri_destroy (fi->keywords); | 850 | if (NULL != fi->keywords) |
851 | GNUNET_FS_uri_destroy (fi->keywords); | ||
851 | GNUNET_CONTAINER_meta_data_destroy (fi->meta); | 852 | GNUNET_CONTAINER_meta_data_destroy (fi->meta); |
852 | GNUNET_free_non_null (fi->serialization); | 853 | GNUNET_free_non_null (fi->serialization); |
853 | if (fi->te != NULL) | 854 | if (fi->te != NULL) |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index c99e598b1..b437fcf80 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -300,10 +300,8 @@ publish_sblock (struct GNUNET_FS_PublishContext *sc) | |||
300 | 300 | ||
301 | 301 | ||
302 | /** | 302 | /** |
303 | * We've finished publishing a KBlock | 303 | * We've finished publishing a KBlock as part of a larger upload. |
304 | * as part of a larger upload. Check | 304 | * Check the result and continue the larger upload. |
305 | * the result and continue the larger | ||
306 | * upload. | ||
307 | * | 305 | * |
308 | * @param cls the "struct GNUNET_FS_PublishContext*" | 306 | * @param cls the "struct GNUNET_FS_PublishContext*" |
309 | * of the larger upload | 307 | * of the larger upload |
@@ -865,16 +863,25 @@ do_upload (void *cls, | |||
865 | if (NULL != p->chk_uri) | 863 | if (NULL != p->chk_uri) |
866 | { | 864 | { |
867 | /* upload of "p" complete, publish KBlocks! */ | 865 | /* upload of "p" complete, publish KBlocks! */ |
868 | GNUNET_FS_publish_ksk (sc->h, | 866 | if (p->keywords != NULL) |
869 | p->keywords, | 867 | { |
870 | p->meta, | 868 | GNUNET_FS_publish_ksk (sc->h, |
871 | p->chk_uri, | 869 | p->keywords, |
872 | p->expirationTime, | 870 | p->meta, |
873 | p->anonymity, | 871 | p->chk_uri, |
874 | p->priority, | 872 | p->expirationTime, |
875 | sc->options, | 873 | p->anonymity, |
876 | &publish_kblocks_cont, | 874 | p->priority, |
877 | sc); | 875 | sc->options, |
876 | &publish_kblocks_cont, | ||
877 | sc); | ||
878 | } | ||
879 | else | ||
880 | { | ||
881 | publish_kblocks_cont (sc, | ||
882 | p->chk_uri, | ||
883 | NULL); | ||
884 | } | ||
878 | return; | 885 | return; |
879 | } | 886 | } |
880 | if ( (!p->is_directory) && | 887 | if ( (!p->is_directory) && |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 11ab41582..da7d6fb0a 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include "gnunet-service-fs_indexing.h" | 43 | #include "gnunet-service-fs_indexing.h" |
44 | #include "fs.h" | 44 | #include "fs.h" |
45 | 45 | ||
46 | #define DEBUG_FS GNUNET_NO | 46 | #define DEBUG_FS GNUNET_YES |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Maximum number of outgoing messages we queue per peer. | 49 | * Maximum number of outgoing messages we queue per peer. |
diff --git a/src/fs/test_fs_lib_data.conf b/src/fs/test_fs_lib_data.conf index b9d11c371..43fea398e 100644 --- a/src/fs/test_fs_lib_data.conf +++ b/src/fs/test_fs_lib_data.conf | |||
@@ -12,11 +12,12 @@ HOSTNAME = localhost | |||
12 | [transport] | 12 | [transport] |
13 | PORT = 43465 | 13 | PORT = 43465 |
14 | PLUGINS = tcp | 14 | PLUGINS = tcp |
15 | #DEBUG = YES | ||
15 | 16 | ||
16 | [arm] | 17 | [arm] |
17 | PORT = 43466 | 18 | PORT = 43466 |
18 | HOSTNAME = localhost | 19 | HOSTNAME = localhost |
19 | DEFAULTSERVICES = resolver datastore transport core fs | 20 | DEFAULTSERVICES = resolver datastore transport core fs peerinfo |
20 | 21 | ||
21 | [datastore] | 22 | [datastore] |
22 | #DEBUG = YES | 23 | #DEBUG = YES |
@@ -28,7 +29,7 @@ HOSTNAME = localhost | |||
28 | [transport-tcp] | 29 | [transport-tcp] |
29 | ALLOW_SHUTDOWN = NO | 30 | ALLOW_SHUTDOWN = NO |
30 | TIMEOUT = 300000 | 31 | TIMEOUT = 300000 |
31 | PORT = 43468 | 32 | #PORT = 43468 |
32 | 33 | ||
33 | [peerinfo] | 34 | [peerinfo] |
34 | PORT = 43469 | 35 | PORT = 43469 |
@@ -37,12 +38,13 @@ HOSTNAME = localhost | |||
37 | [core] | 38 | [core] |
38 | PORT = 43470 | 39 | PORT = 43470 |
39 | HOSTNAME = localhost | 40 | HOSTNAME = localhost |
41 | #DEBUG = YES | ||
40 | 42 | ||
41 | [fs] | 43 | [fs] |
42 | PORT = 43471 | 44 | PORT = 43471 |
43 | HOSTNAME = localhost | 45 | HOSTNAME = localhost |
44 | #DEBUG = YES | 46 | DEBUG = YES |
45 | #PREFIX = valgrind --tool=memcheck --leak-check=yes | 47 | PREFIX = valgrind --tool=memcheck --leak-check=yes |
46 | #BINARY = /home/grothoff/bin/gnunet-service-fs | 48 | #BINARY = /home/grothoff/bin/gnunet-service-fs |
47 | 49 | ||
48 | [testing] | 50 | [testing] |
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index e31e7a691..6b95221d1 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 "test_fs_lib.h" | 27 | #include "test_fs_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. |
@@ -70,7 +70,7 @@ do_download (void *cls, | |||
70 | "Downloading %llu bytes\n", | 70 | "Downloading %llu bytes\n", |
71 | (unsigned long long) FILESIZE); | 71 | (unsigned long long) FILESIZE); |
72 | GNUNET_FS_TEST_download (sched, | 72 | GNUNET_FS_TEST_download (sched, |
73 | daemons[1], | 73 | daemons[0], |
74 | TIMEOUT, | 74 | TIMEOUT, |
75 | 1, SEED, uri, | 75 | 1, SEED, uri, |
76 | VERBOSE, | 76 | VERBOSE, |
@@ -87,7 +87,7 @@ do_publish (void *cls, | |||
87 | "Publishing %llu bytes\n", | 87 | "Publishing %llu bytes\n", |
88 | (unsigned long long) FILESIZE); | 88 | (unsigned long long) FILESIZE); |
89 | GNUNET_FS_TEST_publish (sched, | 89 | GNUNET_FS_TEST_publish (sched, |
90 | daemons[1], | 90 | daemons[0], |
91 | TIMEOUT, | 91 | TIMEOUT, |
92 | 1, GNUNET_NO, FILESIZE, SEED, | 92 | 1, GNUNET_NO, FILESIZE, SEED, |
93 | VERBOSE, | 93 | VERBOSE, |
@@ -100,6 +100,8 @@ do_connect (void *cls, | |||
100 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 100 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
101 | { | 101 | { |
102 | GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)); | 102 | GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)); |
103 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
104 | "Daemons started, will now try to connect them\n"); | ||
103 | GNUNET_FS_TEST_daemons_connect (sched, | 105 | GNUNET_FS_TEST_daemons_connect (sched, |
104 | daemons[0], | 106 | daemons[0], |
105 | daemons[1], | 107 | daemons[1], |
@@ -142,6 +144,7 @@ main (int argc, char *argv[]) | |||
142 | GNUNET_GETOPT_OPTION_END | 144 | GNUNET_GETOPT_OPTION_END |
143 | }; | 145 | }; |
144 | 146 | ||
147 | GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); | ||
145 | GNUNET_log_setup ("test_gnunet_service_fs_p2p", | 148 | GNUNET_log_setup ("test_gnunet_service_fs_p2p", |
146 | #if VERBOSE | 149 | #if VERBOSE |
147 | "DEBUG", | 150 | "DEBUG", |
@@ -152,6 +155,7 @@ main (int argc, char *argv[]) | |||
152 | GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, | 155 | GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, |
153 | argvx, "test-gnunet-service-fs-p2p", | 156 | argvx, "test-gnunet-service-fs-p2p", |
154 | "nohelp", options, &run, NULL); | 157 | "nohelp", options, &run, NULL); |
158 | GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); | ||
155 | return 0; | 159 | return 0; |
156 | } | 160 | } |
157 | 161 | ||
diff --git a/src/testing/testing.c b/src/testing/testing.c index d1d0b95c9..3dd4af367 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "gnunet_testing_lib.h" | 40 | #include "gnunet_testing_lib.h" |
41 | #include "gnunet_transport_service.h" | 41 | #include "gnunet_transport_service.h" |
42 | 42 | ||
43 | #define DEBUG_TESTING GNUNET_YES | 43 | #define DEBUG_TESTING GNUNET_NO |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * How long do we wait after starting gnunet-service-arm | 46 | * How long do we wait after starting gnunet-service-arm |
@@ -828,10 +828,13 @@ send_hello(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
828 | if (ctx->hello != NULL) | 828 | if (ctx->hello != NULL) |
829 | { | 829 | { |
830 | GNUNET_TRANSPORT_offer_hello (ctx->d2th, ctx->hello); | 830 | GNUNET_TRANSPORT_offer_hello (ctx->d2th, ctx->hello); |
831 | ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 200)); | 831 | ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello, |
832 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, | ||
833 | 200)); | ||
832 | } | 834 | } |
833 | 835 | ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, | |
834 | ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, ctx->timeout_hello, &send_hello, ctx); | 836 | ctx->timeout_hello, |
837 | &send_hello, ctx); | ||
835 | } | 838 | } |
836 | 839 | ||
837 | 840 | ||
@@ -974,7 +977,8 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
974 | ¬ify_connect_result, ctx); | 977 | ¬ify_connect_result, ctx); |
975 | 978 | ||
976 | GNUNET_TRANSPORT_get_hello (ctx->d1th, &process_hello, ctx); | 979 | GNUNET_TRANSPORT_get_hello (ctx->d1th, &process_hello, ctx); |
977 | ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, ctx->timeout_hello, &send_hello, ctx); | 980 | ctx->hello_send_task = GNUNET_SCHEDULER_add_delayed(ctx->d1->sched, ctx->timeout_hello, |
981 | &send_hello, ctx); | ||
978 | } | 982 | } |
979 | 983 | ||
980 | 984 | ||
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index e206da43e..370000cf1 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -2750,10 +2750,6 @@ handle_hello (void *cls, | |||
2750 | { | 2750 | { |
2751 | int ret; | 2751 | int ret; |
2752 | 2752 | ||
2753 | #if DEBUG_TRANSPORT | ||
2754 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2755 | "Received `%s' request from client\n", "HELLO"); | ||
2756 | #endif | ||
2757 | ret = process_hello (NULL, message); | 2753 | ret = process_hello (NULL, message); |
2758 | GNUNET_SERVER_receive_done (client, ret); | 2754 | GNUNET_SERVER_receive_done (client, ret); |
2759 | } | 2755 | } |
diff --git a/src/util/peer.c b/src/util/peer.c index 2ad4b3d67..5c00d5580 100644 --- a/src/util/peer.c +++ b/src/util/peer.c | |||
@@ -31,21 +31,18 @@ | |||
31 | struct PeerEntry | 31 | struct PeerEntry |
32 | { | 32 | { |
33 | /** | 33 | /** |
34 | * the identifier itself | 34 | * The identifier itself |
35 | */ | 35 | */ |
36 | struct GNUNET_PeerIdentity id; | 36 | struct GNUNET_PeerIdentity id; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Short version of the identifier; | 39 | * Short version of the identifier; if the RC==0, then index of next |
40 | * if the RC==0, then index of next | 40 | * free slot in table, otherwise equal to this slot in the table. |
41 | * free slot in table, otherwise | ||
42 | * equal to this slot in the table. | ||
43 | */ | 41 | */ |
44 | GNUNET_PEER_Id pid; | 42 | GNUNET_PEER_Id pid; |
45 | 43 | ||
46 | /** | 44 | /** |
47 | * Reference counter, 0 if this slot | 45 | * Reference counter, 0 if this slot is not used. |
48 | * is not used. | ||
49 | */ | 46 | */ |
50 | unsigned int rc; | 47 | unsigned int rc; |
51 | }; | 48 | }; |
@@ -144,6 +141,8 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, unsigned int count) | |||
144 | for (i = count - 1; i >= 0; i--) | 141 | for (i = count - 1; i >= 0; i--) |
145 | { | 142 | { |
146 | id = ids[i]; | 143 | id = ids[i]; |
144 | if (id == 0) | ||
145 | continue; | ||
147 | GNUNET_assert (id < size); | 146 | GNUNET_assert (id < size); |
148 | GNUNET_assert (table[id].rc > 0); | 147 | GNUNET_assert (table[id].rc > 0); |
149 | table[id].rc--; | 148 | table[id].rc--; |