aboutsummaryrefslogtreecommitdiff
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
parenta6c22e8b3f3a1b9594b0075c2ae9f0e57e60a897 (diff)
downloadgnunet-97844e1d640c9debfb042ce51116032653508bc9.tar.gz
gnunet-97844e1d640c9debfb042ce51116032653508bc9.zip
debug fun
-rw-r--r--TODO10
-rw-r--r--src/core/gnunet-service-core.c33
-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
5 files changed, 113 insertions, 23 deletions
diff --git a/TODO b/TODO
index 5beff6bb1..c3b8aa051 100644
--- a/TODO
+++ b/TODO
@@ -15,10 +15,16 @@ away), in order in which they will likely be done:
15Urgent items (before announcing ng.gnunet.org): 15Urgent items (before announcing ng.gnunet.org):
16* FS (basic anonymous FS only) 16* FS (basic anonymous FS only)
17 - test multi-peer search/download 17 - test multi-peer search/download
18 + existing bandwidth-reservation code does not work with FS: don't get
19 DBLOCK size bandwidth for reply for a while => trouble for testcase
20 => need to more aggressively increase bandwidth per connection
21 => need to check that bandwidth is assigned properly to begin with
22 + Even with bandwidth-reservation code restricted, message is not
23 delivered to other core/peer/fs. Why?
24 + Same query is sent to the same peer in rather rapid succession (10x/minute?),
25 should tune code to reduce repetition...
18* new webpage 26* new webpage
19 - run peer => have a 0.9.x hostlist 27 - run peer => have a 0.9.x hostlist
20 - improve basic documentation (configure, dependencies, what works, etc.)
21 => get books to work, integrate Ji Lu's page in dev book!
22=> Deploy(able) development network 28=> Deploy(able) development network
23 29
24 30
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 742a8ce76..9351a31c2 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -717,13 +717,16 @@ update_window (int force,
717 struct GNUNET_TIME_Absolute *ts, unsigned int bpm) 717 struct GNUNET_TIME_Absolute *ts, unsigned int bpm)
718{ 718{
719 struct GNUNET_TIME_Relative since; 719 struct GNUNET_TIME_Relative since;
720 unsigned long long increment;
720 721
721 since = GNUNET_TIME_absolute_get_duration (*ts); 722 since = GNUNET_TIME_absolute_get_duration (*ts);
723 increment = (bpm * since.value) / 60 / 1000;
722 if ( (force == GNUNET_NO) && 724 if ( (force == GNUNET_NO) &&
723 (since.value < 60 * 1000) ) 725 (since.value < 60 * 1000) &&
726 (increment < 32 * 1024) )
724 return; /* not even a minute has passed */ 727 return; /* not even a minute has passed */
725 *ts = GNUNET_TIME_absolute_get (); 728 *ts = GNUNET_TIME_absolute_get ();
726 *window += (bpm * since.value) / 60 / 1000; 729 *window += increment;
727 if (*window > MAX_WINDOW_TIME * bpm) 730 if (*window > MAX_WINDOW_TIME * bpm)
728 *window = MAX_WINDOW_TIME * bpm; 731 *window = MAX_WINDOW_TIME * bpm;
729} 732}
@@ -936,7 +939,8 @@ handle_client_request_info (void *cls,
936 const struct RequestInfoMessage *rcm; 939 const struct RequestInfoMessage *rcm;
937 struct Neighbour *n; 940 struct Neighbour *n;
938 struct ConfigurationInfoMessage cim; 941 struct ConfigurationInfoMessage cim;
939 int reserv; 942 int want_reserv;
943 int got_reserv;
940 unsigned long long old_preference; 944 unsigned long long old_preference;
941 struct GNUNET_SERVER_TransmitContext *tc; 945 struct GNUNET_SERVER_TransmitContext *tc;
942 946
@@ -956,19 +960,21 @@ handle_client_request_info (void *cls,
956 n->bpm_out_internal_limit = ntohl (rcm->limit_outbound_bpm); 960 n->bpm_out_internal_limit = ntohl (rcm->limit_outbound_bpm);
957 n->bpm_out = GNUNET_MAX (n->bpm_out_internal_limit, 961 n->bpm_out = GNUNET_MAX (n->bpm_out_internal_limit,
958 n->bpm_out_external_limit); 962 n->bpm_out_external_limit);
959 reserv = ntohl (rcm->reserve_inbound); 963 want_reserv = ntohl (rcm->reserve_inbound);
960 if (reserv < 0) 964 if (want_reserv < 0)
961 { 965 {
962 n->available_recv_window += reserv; 966 n->available_recv_window += want_reserv;
963 } 967 }
964 else if (reserv > 0) 968 else if (want_reserv > 0)
965 { 969 {
966 update_window (GNUNET_NO, 970 update_window (GNUNET_NO,
967 &n->available_recv_window, 971 &n->available_recv_window,
968 &n->last_arw_update, n->bpm_in); 972 &n->last_arw_update, n->bpm_in);
969 if (n->available_recv_window < reserv) 973 if (n->available_recv_window < want_reserv)
970 reserv = n->available_recv_window; 974 got_reserv = n->available_recv_window;
971 n->available_recv_window -= reserv; 975 else
976 got_reserv = want_reserv;
977 n->available_recv_window -= got_reserv;
972 } 978 }
973 old_preference = n->current_preference; 979 old_preference = n->current_preference;
974 n->current_preference += GNUNET_ntohll(rcm->preference_change); 980 n->current_preference += GNUNET_ntohll(rcm->preference_change);
@@ -978,7 +984,12 @@ handle_client_request_info (void *cls,
978 n->current_preference = (unsigned long long) -1; 984 n->current_preference = (unsigned long long) -1;
979 } 985 }
980 update_preference_sum (n->current_preference - old_preference); 986 update_preference_sum (n->current_preference - old_preference);
981 cim.reserved_amount = htonl (reserv); 987 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
988 "Received reservation request for %d bytes for peer `%4s', reserved %d bytes\n",
989 want_reserv,
990 GNUNET_i2s (&rcm->peer),
991 got_reserv);
992 cim.reserved_amount = htonl (got_reserv);
982 cim.bpm_in = htonl (n->bpm_in); 993 cim.bpm_in = htonl (n->bpm_in);
983 cim.bpm_out = htonl (n->bpm_out); 994 cim.bpm_out = htonl (n->bpm_out);
984 cim.preference = n->current_preference; 995 cim.preference = n->current_preference;
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]