aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-02-22 13:58:37 +0000
committerChristian Grothoff <christian@grothoff.org>2010-02-22 13:58:37 +0000
commit97844e1d640c9debfb042ce51116032653508bc9 (patch)
treee30b88d9f08c5724c30eb758dbd549dacd2bdfec /src/fs
parenta6c22e8b3f3a1b9594b0075c2ae9f0e57e60a897 (diff)
downloadgnunet-97844e1d640c9debfb042ce51116032653508bc9.tar.gz
gnunet-97844e1d640c9debfb042ce51116032653508bc9.zip
debug fun
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/Makefile.am4
-rw-r--r--src/fs/gnunet-service-fs.c87
-rw-r--r--src/fs/test_fs_lib_data.conf2
3 files changed, 83 insertions, 10 deletions
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 15a52fe86..fa5ed090e 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -138,8 +138,8 @@ TESTS = \
138 test_fs_start_stop \ 138 test_fs_start_stop \
139 test_fs_unindex \ 139 test_fs_unindex \
140 test_fs_uri \ 140 test_fs_uri \
141 test_fs_test_lib \ 141 test_fs_test_lib
142 test_gnunet_service_fs_p2p 142# test_gnunet_service_fs_p2p
143# $(check_PROGRAMS) 143# $(check_PROGRAMS)
144 144
145 145
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index b76542767..7ae9aaafa 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -959,7 +959,7 @@ transmit_to_peer (void *cls,
959 { 959 {
960#if DEBUG_FS 960#if DEBUG_FS
961 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 961 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
962 "Dropping reply, core too busy.\n"); 962 "Dropping message, core too busy.\n");
963#endif 963#endif
964 return 0; 964 return 0;
965 } 965 }
@@ -984,6 +984,12 @@ transmit_to_peer (void *cls,
984 &transmit_to_peer, 984 &transmit_to_peer,
985 pm); 985 pm);
986 } 986 }
987#if DEBUG_FS
988 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
989 "Transmitting %u bytes to peer %u.\n",
990 msize,
991 cp->pid);
992#endif
987 return msize; 993 return msize;
988} 994}
989 995
@@ -1039,6 +1045,10 @@ add_to_pending_messages_for_peer (struct ConnectedPeer *cp,
1039 } 1045 }
1040 if (cp->cth == NULL) 1046 if (cp->cth == NULL)
1041 { 1047 {
1048#if DEBUG_FS
1049 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1050 "Failed to schedule transmission with core!\n");
1051#endif
1042 /* FIXME: call stats (rare, bad case) */ 1052 /* FIXME: call stats (rare, bad case) */
1043 } 1053 }
1044} 1054}
@@ -1227,19 +1237,41 @@ target_reservation_cb (void *cls,
1227 if (cp == NULL) 1237 if (cp == NULL)
1228 { 1238 {
1229 /* Peer must have just left */ 1239 /* Peer must have just left */
1240#if DEBUG_FS
1241 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1242 "Selected peer disconnected!\n");
1243#endif
1230 return; 1244 return;
1231 } 1245 }
1232 no_route = GNUNET_NO; 1246 no_route = GNUNET_NO;
1233 if (amount != DBLOCK_SIZE) 1247 /* FIXME: check against DBLOCK_SIZE and possibly return
1248 amount to reserve; however, this also needs to work
1249 with testcases which currently start out with a far
1250 too low per-peer bw limit, so they would never send
1251 anything. Big issue. */
1252 if (amount == 0)
1234 { 1253 {
1235 if (pr->cp == NULL) 1254 if (pr->cp == NULL)
1236 return; /* this target round failed */ 1255 {
1256#if DEBUG_FS
1257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1258 "Failed to reserve bandwidth for reply (got %d/%u bytes only)!\n",
1259 amount,
1260 DBLOCK_SIZE);
1261#endif
1262 return; /* this target round failed */
1263 }
1237 /* FIXME: if we are "quite" busy, we may still want to skip 1264 /* FIXME: if we are "quite" busy, we may still want to skip
1238 this round; need more load detection code! */ 1265 this round; need more load detection code! */
1239 no_route = GNUNET_YES; 1266 no_route = GNUNET_YES;
1240 } 1267 }
1241 1268
1242 /* build message and insert message into priority queue */ 1269 /* build message and insert message into priority queue */
1270#if DEBUG_FS
1271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1272 "Forwarding request to `%4s'!\n",
1273 GNUNET_i2s (peer));
1274#endif
1243 k = 0; 1275 k = 0;
1244 bm = 0; 1276 bm = 0;
1245 if (GNUNET_YES == no_route) 1277 if (GNUNET_YES == no_route)
@@ -1389,7 +1421,13 @@ forward_request_task (void *cls,
1389 &target_peer_select_cb, 1421 &target_peer_select_cb,
1390 &psc); 1422 &psc);
1391 if (psc.target_score == DBL_MIN) 1423 if (psc.target_score == DBL_MIN)
1392 return; /* nobody selected */ 1424 {
1425#if DEBUG_FS
1426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1427 "No peer selected for forwarding!\n");
1428#endif
1429 return; /* nobody selected */
1430 }
1393 1431
1394 /* (2) reserve reply bandwidth */ 1432 /* (2) reserve reply bandwidth */
1395 cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, 1433 cp = GNUNET_CONTAINER_multihashmap_get (connected_peers,
@@ -1913,6 +1951,10 @@ process_local_reply (void *cls,
1913 pr->drq = NULL; 1951 pr->drq = NULL;
1914 if (NULL == key) 1952 if (NULL == key)
1915 { 1953 {
1954#if DEBUG_FS
1955 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1956 "Done processing local replies, forwarding request to other peers.\n");
1957#endif
1916 if (pr->client_request_list != NULL) 1958 if (pr->client_request_list != NULL)
1917 GNUNET_SERVER_receive_done (pr->client_request_list->client_list->client, 1959 GNUNET_SERVER_receive_done (pr->client_request_list->client_list->client,
1918 GNUNET_YES); 1960 GNUNET_YES);
@@ -1925,6 +1967,10 @@ process_local_reply (void *cls,
1925 } 1967 }
1926 if (type == GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND) 1968 if (type == GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND)
1927 { 1969 {
1970#if DEBUG_FS
1971 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1972 "Found ONDEMAND block, performing on-demand encoding\n");
1973#endif
1928 if (GNUNET_OK != 1974 if (GNUNET_OK !=
1929 GNUNET_FS_handle_on_demand_block (key, size, data, type, priority, 1975 GNUNET_FS_handle_on_demand_block (key, size, data, type, priority,
1930 anonymity, expiration, uid, 1976 anonymity, expiration, uid,
@@ -1989,10 +2035,15 @@ process_local_reply (void *cls,
1989 prq.priority = priority; 2035 prq.priority = priority;
1990 process_reply (&prq, key, pr); 2036 process_reply (&prq, key, pr);
1991 2037
1992 if ( (GNUNET_YES == test_load_too_high()) || 2038 if ( ( (pr->client_request_list == NULL) &&
1993 (pr->results_found > 5 + 2 * pr->priority) || 2039 ( (GNUNET_YES == test_load_too_high()) ||
1994 (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK) ) 2040 (pr->results_found > 5 + 2 * pr->priority) ) ) ||
2041 (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK) )
1995 { 2042 {
2043#if DEBUG_FS
2044 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2045 "Unique reply found or load too high, done with request\n");
2046#endif
1996 GNUNET_FS_drq_get_next (GNUNET_NO); 2047 GNUNET_FS_drq_get_next (GNUNET_NO);
1997 return; 2048 return;
1998 } 2049 }
@@ -2164,7 +2215,18 @@ handle_p2p_get (void *cls,
2164 cp = cps; 2215 cp = cps;
2165 if (cp == NULL) 2216 if (cp == NULL)
2166 { 2217 {
2167 /* FIXME: try connect? */ 2218#if DEBUG_FS
2219 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO))
2220 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2221 "Failed to find RETURN-TO peer `%4s' in connection set. Dropping query.\n",
2222 GNUNET_i2s ((const struct GNUNET_PeerIdentity*) &opt[bits-1]));
2223
2224 else
2225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2226 "Failed to find peer `%4s' in connection set. Dropping query.\n",
2227 GNUNET_i2s (other));
2228#endif
2229 /* FIXME: try connect? */
2168 return GNUNET_OK; 2230 return GNUNET_OK;
2169 } 2231 }
2170 /* note that we can really only check load here since otherwise 2232 /* note that we can really only check load here since otherwise
@@ -2250,6 +2312,11 @@ handle_p2p_get (void *cls,
2250 /* existing request has higher TTL, drop new one! */ 2312 /* existing request has higher TTL, drop new one! */
2251 cdc.have->priority += pr->priority; 2313 cdc.have->priority += pr->priority;
2252 destroy_pending_request (pr); 2314 destroy_pending_request (pr);
2315#if DEBUG_FS
2316 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2317 "Have existing request with higher TTL, dropping new request.\n",
2318 GNUNET_i2s (other));
2319#endif
2253 return GNUNET_OK; 2320 return GNUNET_OK;
2254 } 2321 }
2255 else 2322 else
@@ -2390,6 +2457,10 @@ handle_start_search (void *cls,
2390 crl = crl->next; 2457 crl = crl->next;
2391 if (crl != NULL) 2458 if (crl != NULL)
2392 { 2459 {
2460#if DEBUG_FS
2461 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2462 "Have existing request, merging content-seen lists.\n");
2463#endif
2393 pr = crl->req; 2464 pr = crl->req;
2394 /* Duplicate request (used to send long list of 2465 /* Duplicate request (used to send long list of
2395 known/blocked results); merge 'pr->replies_seen' 2466 known/blocked results); merge 'pr->replies_seen'
diff --git a/src/fs/test_fs_lib_data.conf b/src/fs/test_fs_lib_data.conf
index 693342be0..23cb948c4 100644
--- a/src/fs/test_fs_lib_data.conf
+++ b/src/fs/test_fs_lib_data.conf
@@ -38,6 +38,8 @@ HOSTNAME = localhost
38[core] 38[core]
39PORT = 43470 39PORT = 43470
40HOSTNAME = localhost 40HOSTNAME = localhost
41#TOTAL_QUOTA_IN = 3932160
42#TOTAL_QUOTA_OUT = 3932160
41#DEBUG = YES 43#DEBUG = YES
42 44
43[fs] 45[fs]