diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-07-07 21:05:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-07-07 21:05:26 +0000 |
commit | 47ce8ebec034a9744a0ae85aaa61882f88c906fd (patch) | |
tree | ea22b3546d93047b7069f5c28b3411b509daf91c /src/fs | |
parent | 6b9fb6394e8d0deb3ae1802b7fc191a3b35cf587 (diff) | |
download | gnunet-47ce8ebec034a9744a0ae85aaa61882f88c906fd.tar.gz gnunet-47ce8ebec034a9744a0ae85aaa61882f88c906fd.zip |
hackery
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 44d787a96..b3f14896b 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -24,11 +24,9 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * TODO: | 26 | * TODO: |
27 | * - bound_priority should not charge if we are not loaded (excess-based economy) | 27 | * - implement test_load_too_high, make decision priority-based, implement forwarding, etc. |
28 | * - have a way to drop queries based on load (or just forward...) | ||
29 | * - introduce random latency in processing | ||
30 | * - consider more precise latency estimation (per-peer & request) | 28 | * - consider more precise latency estimation (per-peer & request) |
31 | * - better algorithm for priority selection for requests we initiate? | 29 | * - introduce random latency in processing |
32 | * - tell other peers to stop migration if our PUTs fail (or if | 30 | * - tell other peers to stop migration if our PUTs fail (or if |
33 | * we don't support migration per configuration?) | 31 | * we don't support migration per configuration?) |
34 | * - more statistics | 32 | * - more statistics |
@@ -1792,12 +1790,12 @@ mingle_hash (const GNUNET_HashCode * in, | |||
1792 | * to even consider processing the query at | 1790 | * to even consider processing the query at |
1793 | * all. | 1791 | * all. |
1794 | * | 1792 | * |
1795 | * @return GNUNET_YES if the load is too high, GNUNET_NO otherwise | 1793 | * @return GNUNET_YES if the load is too high to do anything, GNUNET_NO to forward (load high, but not too high), GNUNET_SYSERR to indirect (load low) |
1796 | */ | 1794 | */ |
1797 | static int | 1795 | static int |
1798 | test_load_too_high () | 1796 | test_load_too_high () |
1799 | { | 1797 | { |
1800 | return GNUNET_NO; // FIXME | 1798 | return GNUNET_SYSERR; // FIXME |
1801 | } | 1799 | } |
1802 | 1800 | ||
1803 | 1801 | ||
@@ -3111,8 +3109,11 @@ bound_priority (uint32_t prio_in, | |||
3111 | #define N ((double)128.0) | 3109 | #define N ((double)128.0) |
3112 | uint32_t ret; | 3110 | uint32_t ret; |
3113 | double rret; | 3111 | double rret; |
3114 | /* FIXME: check if load is low and we | 3112 | int ld; |
3115 | hence should not charge... */ | 3113 | |
3114 | ld = test_load_too_high (); | ||
3115 | if (ld == GNUNET_SYSERR) | ||
3116 | return 0; /* excess resources */ | ||
3116 | ret = change_host_trust (cp, prio_in); | 3117 | ret = change_host_trust (cp, prio_in); |
3117 | if (ret > 0) | 3118 | if (ret > 0) |
3118 | { | 3119 | { |
@@ -3191,6 +3192,7 @@ handle_p2p_get (void *cls, | |||
3191 | uint32_t ttl_decrement; | 3192 | uint32_t ttl_decrement; |
3192 | enum GNUNET_BLOCK_Type type; | 3193 | enum GNUNET_BLOCK_Type type; |
3193 | int have_ns; | 3194 | int have_ns; |
3195 | int ld; | ||
3194 | 3196 | ||
3195 | msize = ntohs(message->size); | 3197 | msize = ntohs(message->size); |
3196 | if (msize < sizeof (struct GetMessage)) | 3198 | if (msize < sizeof (struct GetMessage)) |
@@ -3274,7 +3276,11 @@ handle_p2p_get (void *cls, | |||
3274 | /* note that we can really only check load here since otherwise | 3276 | /* note that we can really only check load here since otherwise |
3275 | peers could find out that we are overloaded by not being | 3277 | peers could find out that we are overloaded by not being |
3276 | disconnected after sending us a malformed query... */ | 3278 | disconnected after sending us a malformed query... */ |
3277 | if (GNUNET_YES == test_load_too_high ()) | 3279 | |
3280 | /* FIXME: query priority should play | ||
3281 | a major role here! */ | ||
3282 | ld = test_load_too_high (); | ||
3283 | if (GNUNET_YES == ld) | ||
3278 | { | 3284 | { |
3279 | #if DEBUG_FS | 3285 | #if DEBUG_FS |
3280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -3287,6 +3293,8 @@ handle_p2p_get (void *cls, | |||
3287 | GNUNET_NO); | 3293 | GNUNET_NO); |
3288 | return GNUNET_OK; | 3294 | return GNUNET_OK; |
3289 | } | 3295 | } |
3296 | /* FIXME: if ld == GNUNET_NO, forward | ||
3297 | instead of indirecting! */ | ||
3290 | 3298 | ||
3291 | #if DEBUG_FS | 3299 | #if DEBUG_FS |
3292 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3300 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |