aboutsummaryrefslogtreecommitdiff
path: root/src/zonemaster
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-30 18:58:55 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-30 18:58:55 +0200
commit4e8ed070519a3e51255586f6d8282972a1c08987 (patch)
tree40cec0495b08e90ac05b0ce64b41a775ced89285 /src/zonemaster
parent75bc13ffbb0c3081129706f7c22bf61234f2358e (diff)
downloadgnunet-4e8ed070519a3e51255586f6d8282972a1c08987.tar.gz
gnunet-4e8ed070519a3e51255586f6d8282972a1c08987.zip
also limit ma DHT puts
Diffstat (limited to 'src/zonemaster')
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c
index 3be822529..324eb3b5d 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -172,11 +172,16 @@ static struct DhtPutActivity *it_head;
172static struct DhtPutActivity *it_tail; 172static struct DhtPutActivity *it_tail;
173 173
174/** 174/**
175 * Number of entries in the DHT queue. 175 * Number of entries in the DHT queue #it_head.
176 */ 176 */
177static unsigned int dht_queue_length; 177static unsigned int dht_queue_length;
178 178
179/** 179/**
180 * Number of entries in the DHT queue #ma_head.
181 */
182static unsigned int ma_queue_length;
183
184/**
180 * Useful for zone update for DHT put 185 * Useful for zone update for DHT put
181 */ 186 */
182static unsigned long long num_public_records; 187static unsigned long long num_public_records;
@@ -369,7 +374,7 @@ dht_put_monitor_continuation (void *cls)
369{ 374{
370 struct DhtPutActivity *ma = cls; 375 struct DhtPutActivity *ma = cls;
371 376
372 num_public_records++; 377 ma_queue_length--;
373 GNUNET_CONTAINER_DLL_remove (ma_head, 378 GNUNET_CONTAINER_DLL_remove (ma_head,
374 ma_tail, 379 ma_tail,
375 ma); 380 ma);
@@ -911,6 +916,7 @@ handle_monitor_event (void *cls,
911 rd_public); 916 rd_public);
912 if (0 == rd_public_count) 917 if (0 == rd_public_count)
913 return; /* nothing to do */ 918 return; /* nothing to do */
919 num_public_records++;
914 ma = GNUNET_new (struct DhtPutActivity); 920 ma = GNUNET_new (struct DhtPutActivity);
915 ma->start_date = GNUNET_TIME_absolute_get (); 921 ma->start_date = GNUNET_TIME_absolute_get ();
916 ma->ph = perform_dht_put (zone, 922 ma->ph = perform_dht_put (zone,
@@ -928,6 +934,21 @@ handle_monitor_event (void *cls,
928 GNUNET_CONTAINER_DLL_insert (ma_head, 934 GNUNET_CONTAINER_DLL_insert (ma_head,
929 ma_tail, 935 ma_tail,
930 ma); 936 ma);
937 ma_queue_length++;
938 if (ma_queue_length > DHT_QUEUE_LIMIT)
939 {
940 ma = it_head;
941 GNUNET_CONTAINER_DLL_remove (ma_head,
942 ma_tail,
943 ma);
944 GNUNET_DHT_put_cancel (ma->ph);
945 ma_queue_length--;
946 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
947 "DHT PUT unconfirmed after %s, aborting PUT\n",
948 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (ma->start_date),
949 GNUNET_YES));
950 GNUNET_free (ma);
951 }
931} 952}
932 953
933 954