diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-23 15:33:51 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-23 15:33:51 +0100 |
commit | 7c95ee4ac5390170c35894687d9d9ea24e595fd1 (patch) | |
tree | 8b752cfe7e712d8b91d051243417702493e80b12 /src/datastore | |
parent | 427b846c6c52194e5246bc913c65ac632f54f604 (diff) | |
download | gnunet-7c95ee4ac5390170c35894687d9d9ea24e595fd1.tar.gz gnunet-7c95ee4ac5390170c35894687d9d9ea24e595fd1.zip |
even nicer queue size optimization: insert-at-tail if we can instantly tell, always
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/datastore_api.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index b2fc18947..916e6acae 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -498,19 +498,17 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, | |||
498 | struct GNUNET_DATASTORE_QueueEntry *pos; | 498 | struct GNUNET_DATASTORE_QueueEntry *pos; |
499 | unsigned int c; | 499 | unsigned int c; |
500 | 500 | ||
501 | if ( (h->queue_size == max_queue_size) && | 501 | if ( (NULL != h->queue_tail) && |
502 | (h->queue_tail->priority >= queue_priority) ) | 502 | (h->queue_tail->priority >= queue_priority) ) |
503 | { | 503 | { |
504 | GNUNET_STATISTICS_update (h->stats, | 504 | c = h->queue_size; |
505 | gettext_noop ("# queue overflows"), | 505 | pos = NULL; |
506 | 1, | 506 | } |
507 | GNUNET_NO); | 507 | else |
508 | GNUNET_MQ_discard (env); | 508 | { |
509 | return NULL; | 509 | c = 0; |
510 | pos = h->queue_head; | ||
510 | } | 511 | } |
511 | |||
512 | c = 0; | ||
513 | pos = h->queue_head; | ||
514 | while ( (NULL != pos) && | 512 | while ( (NULL != pos) && |
515 | (c < max_queue_size) && | 513 | (c < max_queue_size) && |
516 | (pos->priority >= queue_priority) ) | 514 | (pos->priority >= queue_priority) ) |