aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-23 15:32:06 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-23 15:32:06 +0100
commit427b846c6c52194e5246bc913c65ac632f54f604 (patch)
treeebad996167eb6af33319b17165577c1c7dd39248 /src/datastore
parent6f8ad5f4421b88d22cdb67e0188de132a0031cbc (diff)
downloadgnunet-427b846c6c52194e5246bc913c65ac632f54f604.tar.gz
gnunet-427b846c6c52194e5246bc913c65ac632f54f604.zip
optimize queue-full case, reduce max queue size due to O(n) operation
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/datastore_api.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 311a61283..b2fc18947 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -498,6 +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) &&
502 (h->queue_tail->priority >= queue_priority) )
503 {
504 GNUNET_STATISTICS_update (h->stats,
505 gettext_noop ("# queue overflows"),
506 1,
507 GNUNET_NO);
508 GNUNET_MQ_discard (env);
509 return NULL;
510 }
511
501 c = 0; 512 c = 0;
502 pos = h->queue_head; 513 pos = h->queue_head;
503 while ( (NULL != pos) && 514 while ( (NULL != pos) &&