diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-12-23 15:09:11 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-12-23 15:09:11 +0000 |
commit | 0acc583b6e411a5f1ebd6172458baaad992c456e (patch) | |
tree | 06f2acf19d889249e8c7256c8cbe07d0d3488349 /src/fs | |
parent | 8149805b0539d29420b9e2b5a60fc09b2d69b348 (diff) | |
download | gnunet-0acc583b6e411a5f1ebd6172458baaad992c456e.tar.gz gnunet-0acc583b6e411a5f1ebd6172458baaad992c456e.zip |
updating heap API and implementation
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index bec69f6ec..ed68dcc4a 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -446,6 +446,11 @@ struct PendingRequest | |||
446 | GNUNET_HashCode *replies_seen; | 446 | GNUNET_HashCode *replies_seen; |
447 | 447 | ||
448 | /** | 448 | /** |
449 | * Node in the heap representing this entry. | ||
450 | */ | ||
451 | struct GNUNET_CONTAINER_HeapNode *hnode; | ||
452 | |||
453 | /** | ||
449 | * When did we first see this request (form this peer), or, if our | 454 | * When did we first see this request (form this peer), or, if our |
450 | * client is initiating, when did we last initiate a search? | 455 | * client is initiating, when did we last initiate a search? |
451 | */ | 456 | */ |
@@ -2214,7 +2219,7 @@ destroy_pending_request (struct PendingRequest *pr) | |||
2214 | if (pr->client == NULL) | 2219 | if (pr->client == NULL) |
2215 | { | 2220 | { |
2216 | GNUNET_CONTAINER_heap_remove_node (requests_by_expiration, | 2221 | GNUNET_CONTAINER_heap_remove_node (requests_by_expiration, |
2217 | pr); | 2222 | pr->hnode); |
2218 | } | 2223 | } |
2219 | else | 2224 | else |
2220 | { | 2225 | { |
@@ -2480,9 +2485,9 @@ forward_get_request (void *cls, | |||
2480 | &pgc->reply_to.hashPubKey, | 2485 | &pgc->reply_to.hashPubKey, |
2481 | pr, | 2486 | pr, |
2482 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2487 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2483 | GNUNET_CONTAINER_heap_insert (requests_by_expiration, | 2488 | pr->hnode = GNUNET_CONTAINER_heap_insert (requests_by_expiration, |
2484 | pr, | 2489 | pr, |
2485 | pr->start_time.value + pr->ttl); | 2490 | pr->start_time.value + pr->ttl); |
2486 | if (GNUNET_CONTAINER_heap_get_size (requests_by_expiration) > max_pending_requests) | 2491 | if (GNUNET_CONTAINER_heap_get_size (requests_by_expiration) > max_pending_requests) |
2487 | { | 2492 | { |
2488 | /* expire oldest request! */ | 2493 | /* expire oldest request! */ |