diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-24 22:44:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-24 22:44:22 +0000 |
commit | ad9e7ee447a687725cc29138703502c0d23dd9cb (patch) | |
tree | 41d83455117804defc6f2ecd1218df570eac293d | |
parent | a2467fb0dcd123ad6ed0cab821ac9cec5d63d01a (diff) | |
download | gnunet-ad9e7ee447a687725cc29138703502c0d23dd9cb.tar.gz gnunet-ad9e7ee447a687725cc29138703502c0d23dd9cb.zip |
hacking on fs features
-rw-r--r-- | TODO | 42 | ||||
-rw-r--r-- | src/fs/fs.h | 4 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 126 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 2 | ||||
-rw-r--r-- | src/util/crypto_hash.c | 6 |
5 files changed, 118 insertions, 62 deletions
@@ -1,15 +1,19 @@ | |||
1 | 0.9.0pre1: | 1 | 0.9.0pre1: |
2 | * FS: [CG] | ||
3 | - TTL/priority calculations | ||
4 | - hot-path routing | ||
5 | * TRANSPORT: | 2 | * TRANSPORT: |
3 | - PING Signing [CG] | ||
6 | - HTTP backend [MW] | 4 | - HTTP backend [MW] |
7 | * DV: [Nate] | 5 | * ARM: |
8 | - implement performance tests (needs tbench) | 6 | - make listen socket forwarding to child processes on supported platforms |
7 | optional for debugging [CG/Nate] | ||
8 | * CORE: | ||
9 | - derived key generation [Nils] | ||
9 | * UTIL: | 10 | * UTIL: |
10 | - only connect() sockets that are ready (select()) [Nils] | 11 | - only connect() sockets that are ready (select()) [Nils] |
11 | [On W32, we need to select after calling socket before doing connect etc.] | 12 | [On W32, we need to select after calling socket before doing connect etc.] |
12 | * GNUNET-GTK: | 13 | * DATASTORE [CG]: |
14 | - check for duplicates on insertion (currently, same content is frequently | ||
15 | stored again [seen with KBLOCKS and SBLOCKS]!) | ||
16 | * GNUNET-GTK: [CG] | ||
13 | - directory support: | 17 | - directory support: |
14 | + download start: recursive/directory (!) & from-URI only | 18 | + download start: recursive/directory (!) & from-URI only |
15 | + handle download lost-parent (move to 'from-URI only' tab) | 19 | + handle download lost-parent (move to 'from-URI only' tab) |
@@ -26,22 +30,31 @@ | |||
26 | why is it so slow? Fix! (see core_api_reliability test) | 30 | why is it so slow? Fix! (see core_api_reliability test) |
27 | - implement API to get notifications about bandwidth assignments to individual peers | 31 | - implement API to get notifications about bandwidth assignments to individual peers |
28 | - implement API to get notifications about updates to liveness of individual peers (before disconnect) | 32 | - implement API to get notifications about updates to liveness of individual peers (before disconnect) |
33 | * STATISTICS: | ||
34 | - implement notification-based statistics API | ||
35 | * PEERINFO [CG] | ||
36 | - better API for trust management | ||
29 | * TOPOLOGY: | 37 | * TOPOLOGY: |
30 | - needs more testing (especially F2F topology) & transport blacklisting | 38 | - needs more testing (especially F2F topology) & transport blacklisting |
31 | * TBENCH: [MW] | 39 | * TBENCH: [MW] |
32 | - good to have for transport/DV evaluation! | 40 | - good to have for transport/DV evaluation! |
41 | * DV: [Nate] | ||
42 | - implement performance tests (needs tbench) | ||
33 | * DHT: [Nate] | 43 | * DHT: [Nate] |
34 | - implement DHT service | 44 | - implement DHT service |
35 | - implement testcases | 45 | - implement testcases |
36 | - implement performance tests | 46 | - implement performance tests |
37 | * ARM: [Safey] | 47 | * MONKEY: [Safey] |
38 | - better crash management (attach debugging support, capture and analyze | 48 | - better crash management (attach debugging support, capture and analyze |
39 | debug output, detect random vs. deterministic crashes) | 49 | debug output, detect random vs. deterministic crashes) |
40 | - discover dependencies between services | 50 | * ARM: [CG] |
41 | - handle gnunet-arm -k in combination with auto-start magic (what is the right thing here?) | 51 | - handle gnunet-arm -k in combination with auto-start magic (what is the right thing here?) |
42 | - add listen socket forwarding to child processes on supported platforms | 52 | - discover dependencies between services |
43 | * FS: [CG] | 53 | * FS: [CG] |
54 | - trust & peerinfo integration | ||
44 | - load considerations (migration, routing) | 55 | - load considerations (migration, routing) |
56 | - bound our priorities based on priorities used by other peers | ||
57 | - artificial delays | ||
45 | - active reply route caching design & implementation of service; gap extension! | 58 | - active reply route caching design & implementation of service; gap extension! |
46 | - datastore reservation (publishing) | 59 | - datastore reservation (publishing) |
47 | - location URIs (publish, search, download) | 60 | - location URIs (publish, search, download) |
@@ -61,9 +74,7 @@ | |||
61 | + download | 74 | + download |
62 | + search | 75 | + search |
63 | + unindex | 76 | + unindex |
64 | * STATISTICS: | 77 | * GNUNET-GTK: [CG] |
65 | - implement notification-based statistics API | ||
66 | * GNUNET-GTK: | ||
67 | - implement publish dialog details: | 78 | - implement publish dialog details: |
68 | + open (import directory structure) | 79 | + open (import directory structure) |
69 | + normalize keywords (edit subdialog) | 80 | + normalize keywords (edit subdialog) |
@@ -121,11 +132,11 @@ | |||
121 | * MYSQL database backends: [CG] | 132 | * MYSQL database backends: [CG] |
122 | - datacache | 133 | - datacache |
123 | - datastore | 134 | - datastore |
124 | * FS: | 135 | * FS: [CG] |
125 | - reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME in fs_download) | 136 | - reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME in fs_download) |
126 | - add support for pushing "already seen" search results to FS service for bloomfilter (can wait) | 137 | - add support for pushing "already seen" search results to FS service for bloomfilter (can wait) |
127 | - use different 'priority' for probe downloads vs. normal downloads | 138 | - use different 'priority' for probe downloads vs. normal downloads |
128 | * ARM: | 139 | * ARM: [CG/Safey] |
129 | - better tracking of which config changes actually need to cause process restarts by ARM. | 140 | - better tracking of which config changes actually need to cause process restarts by ARM. |
130 | * SETUP: | 141 | * SETUP: |
131 | - design & implement new setup tool | 142 | - design & implement new setup tool |
@@ -186,9 +197,6 @@ Optimizations: | |||
186 | * TRANSPORT: | 197 | * TRANSPORT: |
187 | - need to periodically probe latency/transport cost changes & possibly switch transport | 198 | - need to periodically probe latency/transport cost changes & possibly switch transport |
188 | - should use hash map to look up Neighbours (service AND plugins!) | 199 | - should use hash map to look up Neighbours (service AND plugins!) |
189 | * DATASTORE (?): | ||
190 | - check for duplicates on insertion (currently, same content is frequently | ||
191 | stored again [seen with KBLOCKS and SBLOCKS]!) | ||
192 | * PEERINFO: | 200 | * PEERINFO: |
193 | - merge multiple HELLOs of the same peer in the transmission queue | 201 | - merge multiple HELLOs of the same peer in the transmission queue |
194 | (theoretically reduces overhead; bounds message queue size) | 202 | (theoretically reduces overhead; bounds message queue size) |
diff --git a/src/fs/fs.h b/src/fs/fs.h index a7ae457d5..b3bf24e2a 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -157,7 +157,7 @@ | |||
157 | /** | 157 | /** |
158 | * Bandwidth value of an (effectively) 0-priority query. | 158 | * Bandwidth value of an (effectively) 0-priority query. |
159 | */ | 159 | */ |
160 | #define QUERY_BANDWIDTH_VALUE 0.001 | 160 | #define QUERY_BANDWIDTH_VALUE 1 |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * Bandwidth value of a 0-priority content (must be | 163 | * Bandwidth value of a 0-priority content (must be |
@@ -166,7 +166,7 @@ | |||
166 | * since it can take many queries to get one piece of | 166 | * since it can take many queries to get one piece of |
167 | * content). | 167 | * content). |
168 | */ | 168 | */ |
169 | #define CONTENT_BANDWIDTH_VALUE 0.8 | 169 | #define CONTENT_BANDWIDTH_VALUE 800 |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * By which amount do we decrement the TTL for simple forwarding / | 172 | * By which amount do we decrement the TTL for simple forwarding / |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index ccdd76de2..e49ff17cd 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -23,13 +23,16 @@ | |||
23 | * @brief gnunet anonymity protocol implementation | 23 | * @brief gnunet anonymity protocol implementation |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * FIXME: | ||
27 | * - TTL/priority calculations are absent! | ||
28 | * TODO: | 26 | * TODO: |
29 | * - have non-zero preference / priority for requests we initiate! | 27 | * - trust not properly received and pushed back to peerinfo! |
30 | * - implement hot-path routing decision procedure | 28 | * - bound_priority by priorities used by other peers |
31 | * - implement: bound_priority, test_load_too_high | 29 | * - have a way to drop queries based on load |
32 | * - statistics | 30 | * - introduce random latency in processing |
31 | * - consider more precise latency estimation (per-peer & request) | ||
32 | * - better algorithm for priority selection for requests we initiate? | ||
33 | * - tell other peers to stop migration if our PUTs fail (or if | ||
34 | * we don't support migration per configuration?) | ||
35 | * - more statistics | ||
33 | */ | 36 | */ |
34 | #include "platform.h" | 37 | #include "platform.h" |
35 | #include <float.h> | 38 | #include <float.h> |
@@ -48,7 +51,6 @@ | |||
48 | 51 | ||
49 | /** | 52 | /** |
50 | * Maximum number of outgoing messages we queue per peer. | 53 | * Maximum number of outgoing messages we queue per peer. |
51 | * FIXME: make configurable? | ||
52 | */ | 54 | */ |
53 | #define MAX_QUEUE_PER_PEER 16 | 55 | #define MAX_QUEUE_PER_PEER 16 |
54 | 56 | ||
@@ -204,9 +206,14 @@ struct ConnectedPeer | |||
204 | 206 | ||
205 | /** | 207 | /** |
206 | * Increase in traffic preference still to be submitted | 208 | * Increase in traffic preference still to be submitted |
207 | * to the core service for this peer. FIXME: double or 'uint64_t'? | 209 | * to the core service for this peer. |
208 | */ | 210 | */ |
209 | double inc_preference; | 211 | uint64_t inc_preference; |
212 | |||
213 | /** | ||
214 | * Trust delta to still commit to the system. | ||
215 | */ | ||
216 | uint32_t trust_delta; | ||
210 | 217 | ||
211 | /** | 218 | /** |
212 | * The peer's identity. | 219 | * The peer's identity. |
@@ -480,7 +487,6 @@ struct PendingRequest | |||
480 | struct GNUNET_DATASTORE_QueueEntry *qe; | 487 | struct GNUNET_DATASTORE_QueueEntry *qe; |
481 | 488 | ||
482 | /** | 489 | /** |
483 | |||
484 | * Size of the 'bf' (in bytes). | 490 | * Size of the 'bf' (in bytes). |
485 | */ | 491 | */ |
486 | size_t bf_size; | 492 | size_t bf_size; |
@@ -1247,7 +1253,11 @@ peer_disconnect_handler (void *cls, | |||
1247 | &consider_migration, | 1253 | &consider_migration, |
1248 | pos); | 1254 | pos); |
1249 | } | 1255 | } |
1250 | 1256 | if (cp->trust_delta > 0) | |
1257 | { | ||
1258 | /* FIXME: push trust back to peerinfo! | ||
1259 | (need better peerinfo API!) */ | ||
1260 | } | ||
1251 | GNUNET_PEER_change_rc (cp->pid, -1); | 1261 | GNUNET_PEER_change_rc (cp->pid, -1); |
1252 | GNUNET_PEER_decrement_rcs (cp->last_p2p_replies, P2P_SUCCESS_LIST_SIZE); | 1262 | GNUNET_PEER_decrement_rcs (cp->last_p2p_replies, P2P_SUCCESS_LIST_SIZE); |
1253 | if (NULL != cp->cth) | 1263 | if (NULL != cp->cth) |
@@ -1856,11 +1866,6 @@ target_reservation_cb (void *cls, | |||
1856 | return; | 1866 | return; |
1857 | } | 1867 | } |
1858 | no_route = GNUNET_NO; | 1868 | no_route = GNUNET_NO; |
1859 | /* FIXME: check against DBLOCK_SIZE and possibly return | ||
1860 | amount to reserve; however, this also needs to work | ||
1861 | with testcases which currently start out with a far | ||
1862 | too low per-peer bw limit, so they would never send | ||
1863 | anything. Big issue. */ | ||
1864 | if (amount == 0) | 1869 | if (amount == 0) |
1865 | { | 1870 | { |
1866 | if (pr->cp == NULL) | 1871 | if (pr->cp == NULL) |
@@ -1997,7 +2002,13 @@ target_peer_select_cb (void *cls, | |||
1997 | 2002 | ||
1998 | /* 1) check that this peer is not the initiator */ | 2003 | /* 1) check that this peer is not the initiator */ |
1999 | if (cp == pr->cp) | 2004 | if (cp == pr->cp) |
2000 | return GNUNET_YES; /* skip */ | 2005 | { |
2006 | #if DEBUG_FS | ||
2007 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2008 | "Skipping initiator in forwarding selection\n"); | ||
2009 | #endif | ||
2010 | return GNUNET_YES; /* skip */ | ||
2011 | } | ||
2001 | 2012 | ||
2002 | /* 2) check if we have already (recently) forwarded to this peer */ | 2013 | /* 2) check if we have already (recently) forwarded to this peer */ |
2003 | pc = 0; | 2014 | pc = 0; |
@@ -2022,13 +2033,47 @@ target_peer_select_cb (void *cls, | |||
2022 | "Re-trying query that was previously transmitted %u times to this peer\n", | 2033 | "Re-trying query that was previously transmitted %u times to this peer\n", |
2023 | (unsigned int) pc); | 2034 | (unsigned int) pc); |
2024 | #endif | 2035 | #endif |
2025 | // 3) calculate how much we'd like to forward to this peer | 2036 | /* 3) calculate how much we'd like to forward to this peer, |
2026 | score = 42; // FIXME! | 2037 | starting with a random value that is strong enough |
2027 | // FIXME: also need API to gather data on responsiveness | 2038 | to at least give any peer a chance sometimes |
2028 | // of this peer (we have fields for that in 'cp', but | 2039 | (compared to the other factors that come later) */ |
2029 | // they are never set!) | 2040 | /* 3a) count successful (recent) routes from cp for same source */ |
2030 | 2041 | if (pr->cp != NULL) | |
2042 | { | ||
2043 | score = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
2044 | P2P_SUCCESS_LIST_SIZE); | ||
2045 | for (i=0;i<P2P_SUCCESS_LIST_SIZE;i++) | ||
2046 | if (cp->last_p2p_replies[i] == pr->cp->pid) | ||
2047 | score += 1; /* likely successful based on hot path */ | ||
2048 | } | ||
2049 | else | ||
2050 | { | ||
2051 | score = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
2052 | CS2P_SUCCESS_LIST_SIZE); | ||
2053 | for (i=0;i<CS2P_SUCCESS_LIST_SIZE;i++) | ||
2054 | if (cp->last_client_replies[i] == pr->client_request_list->client_list->client) | ||
2055 | score += 1; /* likely successful based on hot path */ | ||
2056 | } | ||
2057 | /* 3b) include latency */ | ||
2058 | if (cp->avg_delay.value < 4 * TTL_DECREMENT) | ||
2059 | score += 1; /* likely fast based on latency */ | ||
2060 | /* 3c) include priorities */ | ||
2061 | if (cp->avg_priority <= pr->remaining_priority / 2.0) | ||
2062 | score += 1; /* likely successful based on priorities */ | ||
2063 | /* 3d) penalize for queue size */ | ||
2064 | score -= (2.0 * cp->pending_requests / (double) MAX_QUEUE_PER_PEER); | ||
2065 | /* 3e) include peer proximity */ | ||
2066 | score -= (2.0 * (GNUNET_CRYPTO_hash_distance_u32 (key, | ||
2067 | &pr->query)) / (double) UINT32_MAX); | ||
2031 | /* store best-fit in closure */ | 2068 | /* store best-fit in closure */ |
2069 | #if DEBUG_FS | ||
2070 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2071 | "Peer `%s' gets score %f for forwarding query, max is %f\n", | ||
2072 | GNUNET_h2s (key), | ||
2073 | score, | ||
2074 | psc->target_score); | ||
2075 | #endif | ||
2076 | score++; /* avoid zero */ | ||
2032 | if (score > psc->target_score) | 2077 | if (score > psc->target_score) |
2033 | { | 2078 | { |
2034 | psc->target_score = score; | 2079 | psc->target_score = score; |
@@ -2066,7 +2111,7 @@ bound_ttl (int32_t ttl_in, uint32_t prio) | |||
2066 | 2111 | ||
2067 | 2112 | ||
2068 | /** | 2113 | /** |
2069 | * We're processing a GET request from another peer and have decided | 2114 | * We're processing a GET request and have decided |
2070 | * to forward it to other peers. This function is called periodically | 2115 | * to forward it to other peers. This function is called periodically |
2071 | * and should forward the request to other peers until we have all | 2116 | * and should forward the request to other peers until we have all |
2072 | * possible replies. If we have transmitted the *only* reply to | 2117 | * possible replies. If we have transmitted the *only* reply to |
@@ -2100,11 +2145,11 @@ forward_request_task (void *cls, | |||
2100 | return; /* configured to not do P2P search */ | 2145 | return; /* configured to not do P2P search */ |
2101 | /* (1) select target */ | 2146 | /* (1) select target */ |
2102 | psc.pr = pr; | 2147 | psc.pr = pr; |
2103 | psc.target_score = DBL_MIN; | 2148 | psc.target_score = -DBL_MAX; |
2104 | GNUNET_CONTAINER_multihashmap_iterate (connected_peers, | 2149 | GNUNET_CONTAINER_multihashmap_iterate (connected_peers, |
2105 | &target_peer_select_cb, | 2150 | &target_peer_select_cb, |
2106 | &psc); | 2151 | &psc); |
2107 | if (psc.target_score == DBL_MIN) | 2152 | if (psc.target_score == -DBL_MAX) |
2108 | { | 2153 | { |
2109 | delay = get_processing_delay (); | 2154 | delay = get_processing_delay (); |
2110 | #if DEBUG_FS | 2155 | #if DEBUG_FS |
@@ -2120,7 +2165,6 @@ forward_request_task (void *cls, | |||
2120 | return; /* nobody selected */ | 2165 | return; /* nobody selected */ |
2121 | } | 2166 | } |
2122 | /* (3) update TTL/priority */ | 2167 | /* (3) update TTL/priority */ |
2123 | |||
2124 | if (pr->client_request_list != NULL) | 2168 | if (pr->client_request_list != NULL) |
2125 | { | 2169 | { |
2126 | /* FIXME: use better algorithm!? */ | 2170 | /* FIXME: use better algorithm!? */ |
@@ -2139,10 +2183,6 @@ forward_request_task (void *cls, | |||
2139 | pr->ttl); | 2183 | pr->ttl); |
2140 | #endif | 2184 | #endif |
2141 | } | 2185 | } |
2142 | else | ||
2143 | { | ||
2144 | /* FIXME: should we do something here as well!? */ | ||
2145 | } | ||
2146 | 2186 | ||
2147 | /* (3) reserve reply bandwidth */ | 2187 | /* (3) reserve reply bandwidth */ |
2148 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 2188 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
@@ -2153,10 +2193,10 @@ forward_request_task (void *cls, | |||
2153 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 2193 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
2154 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), | 2194 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), |
2155 | DBLOCK_SIZE * 2, | 2195 | DBLOCK_SIZE * 2, |
2156 | (uint64_t) cp->inc_preference, | 2196 | cp->inc_preference, |
2157 | &target_reservation_cb, | 2197 | &target_reservation_cb, |
2158 | pr); | 2198 | pr); |
2159 | cp->inc_preference = 0.0; | 2199 | cp->inc_preference = 0; |
2160 | } | 2200 | } |
2161 | 2201 | ||
2162 | 2202 | ||
@@ -2574,6 +2614,7 @@ handle_p2p_put (void *cls, | |||
2574 | GNUNET_HashCode query; | 2614 | GNUNET_HashCode query; |
2575 | struct ProcessReplyClosure prq; | 2615 | struct ProcessReplyClosure prq; |
2576 | const struct SBlock *sb; | 2616 | const struct SBlock *sb; |
2617 | struct ConnectedPeer *cps; | ||
2577 | 2618 | ||
2578 | msize = ntohs (message->size); | 2619 | msize = ntohs (message->size); |
2579 | if (msize < sizeof (struct PutMessage)) | 2620 | if (msize < sizeof (struct PutMessage)) |
@@ -2629,6 +2670,10 @@ handle_p2p_put (void *cls, | |||
2629 | &query, | 2670 | &query, |
2630 | &process_reply, | 2671 | &process_reply, |
2631 | &prq); | 2672 | &prq); |
2673 | cps = GNUNET_CONTAINER_multihashmap_get (connected_peers, | ||
2674 | &other->hashPubKey); | ||
2675 | cps->inc_preference += CONTENT_BANDWIDTH_VALUE + 1000 * prq.priority; | ||
2676 | cps->trust_delta += prq.priority; | ||
2632 | if (GNUNET_YES == active_migration) | 2677 | if (GNUNET_YES == active_migration) |
2633 | { | 2678 | { |
2634 | #if DEBUG_FS | 2679 | #if DEBUG_FS |
@@ -2907,7 +2952,13 @@ static uint32_t | |||
2907 | bound_priority (uint32_t prio_in, | 2952 | bound_priority (uint32_t prio_in, |
2908 | struct ConnectedPeer *cp) | 2953 | struct ConnectedPeer *cp) |
2909 | { | 2954 | { |
2910 | return 0; // FIXME! | 2955 | if (cp->trust_delta > prio_in) |
2956 | { | ||
2957 | cp->trust_delta -= prio_in; | ||
2958 | return prio_in; | ||
2959 | } | ||
2960 | // FIXME: get out trust in the target peer from peerinfo! | ||
2961 | return 0; | ||
2911 | } | 2962 | } |
2912 | 2963 | ||
2913 | 2964 | ||
@@ -2973,7 +3024,6 @@ handle_p2p_get (void *cls, | |||
2973 | size_t bfsize; | 3024 | size_t bfsize; |
2974 | uint32_t ttl_decrement; | 3025 | uint32_t ttl_decrement; |
2975 | enum GNUNET_BLOCK_Type type; | 3026 | enum GNUNET_BLOCK_Type type; |
2976 | double preference; | ||
2977 | int have_ns; | 3027 | int have_ns; |
2978 | 3028 | ||
2979 | msize = ntohs(message->size); | 3029 | msize = ntohs(message->size); |
@@ -3195,11 +3245,7 @@ handle_p2p_get (void *cls, | |||
3195 | GNUNET_NO); | 3245 | GNUNET_NO); |
3196 | 3246 | ||
3197 | /* calculate change in traffic preference */ | 3247 | /* calculate change in traffic preference */ |
3198 | preference = (double) pr->priority; | 3248 | cps->inc_preference += pr->priority * 1000 + QUERY_BANDWIDTH_VALUE; |
3199 | if (preference < QUERY_BANDWIDTH_VALUE) | ||
3200 | preference = QUERY_BANDWIDTH_VALUE; | ||
3201 | cps->inc_preference += preference; | ||
3202 | |||
3203 | /* process locally */ | 3249 | /* process locally */ |
3204 | if (type == GNUNET_BLOCK_TYPE_DBLOCK) | 3250 | if (type == GNUNET_BLOCK_TYPE_DBLOCK) |
3205 | type = GNUNET_BLOCK_TYPE_ANY; /* to get on-demand as well */ | 3251 | type = GNUNET_BLOCK_TYPE_ANY; /* to get on-demand as well */ |
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 5e28127e5..d31dfcfa6 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -335,7 +335,7 @@ int GNUNET_CRYPTO_hash_from_string (const char *enc, | |||
335 | * | 335 | * |
336 | * @param a some hash code | 336 | * @param a some hash code |
337 | * @param b some hash code | 337 | * @param b some hash code |
338 | * @return number between 0 and 65536 | 338 | * @return number between 0 and UINT32_MAX |
339 | */ | 339 | */ |
340 | uint32_t GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, | 340 | uint32_t GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, |
341 | const GNUNET_HashCode * b); | 341 | const GNUNET_HashCode * b); |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 09366a949..af492e15e 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -668,8 +668,10 @@ GNUNET_CRYPTO_hash_from_string (const char *enc, GNUNET_HashCode * result) | |||
668 | * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be | 668 | * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be |
669 | * somewhat consistent. And of course, the result should be a positive | 669 | * somewhat consistent. And of course, the result should be a positive |
670 | * number. | 670 | * number. |
671 | * | 671 | * |
672 | * @returns a positive number which is a measure for | 672 | * @param a some hash code |
673 | * @param b some hash code | ||
674 | * @return a positive number which is a measure for | ||
673 | * hashcode proximity. | 675 | * hashcode proximity. |
674 | */ | 676 | */ |
675 | unsigned int | 677 | unsigned int |