diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-25 23:43:09 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-25 23:43:09 +0900 |
commit | 34dd119251f9806a4f83de4d405e654dc6b1bf76 (patch) | |
tree | 710048cc334031afbf3f1ebe2fcba2f49cdc83d0 /src/zonemaster/gnunet-service-zonemaster.c | |
parent | 3eba49dd18d28b9e47111276234997d4ba5283c7 (diff) | |
download | gnunet-34dd119251f9806a4f83de4d405e654dc6b1bf76.tar.gz gnunet-34dd119251f9806a4f83de4d405e654dc6b1bf76.zip |
-improve queue handling
Diffstat (limited to 'src/zonemaster/gnunet-service-zonemaster.c')
-rw-r--r-- | src/zonemaster/gnunet-service-zonemaster.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c index 27a8d0dd3..b0e8dc29c 100644 --- a/src/zonemaster/gnunet-service-zonemaster.c +++ b/src/zonemaster/gnunet-service-zonemaster.c | |||
@@ -201,6 +201,11 @@ struct DhtPutActivity | |||
201 | * When was this PUT initiated? | 201 | * When was this PUT initiated? |
202 | */ | 202 | */ |
203 | struct GNUNET_TIME_Absolute start_date; | 203 | struct GNUNET_TIME_Absolute start_date; |
204 | |||
205 | /** | ||
206 | * Zone monitor | ||
207 | */ | ||
208 | struct GNUNET_NAMESTORE_ZoneMonitor *zm; | ||
204 | }; | 209 | }; |
205 | 210 | ||
206 | /** | 211 | /** |
@@ -767,6 +772,14 @@ dht_put_continuation (void *cls) | |||
767 | 772 | ||
768 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 773 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
769 | "PUT complete\n"); | 774 | "PUT complete\n"); |
775 | /* When we just fall under the limit, trigger monitor or iterator again */ | ||
776 | if (dht_queue_length == DHT_QUEUE_LIMIT) | ||
777 | { | ||
778 | if (NULL != ma->zm) | ||
779 | GNUNET_NAMESTORE_zone_monitor_next (ma->zm, 1); | ||
780 | else | ||
781 | GNUNET_NAMESTORE_zone_iterator_next (namestore_iter, 1); | ||
782 | } | ||
770 | dht_queue_length--; | 783 | dht_queue_length--; |
771 | GNUNET_CONTAINER_DLL_remove (it_head, | 784 | GNUNET_CONTAINER_DLL_remove (it_head, |
772 | it_tail, | 785 | it_tail, |
@@ -1052,7 +1065,6 @@ put_gns_record (void *cls, | |||
1052 | put_cnt++; | 1065 | put_cnt++; |
1053 | if (0 == put_cnt % DELTA_INTERVAL) | 1066 | if (0 == put_cnt % DELTA_INTERVAL) |
1054 | update_velocity (DELTA_INTERVAL); | 1067 | update_velocity (DELTA_INTERVAL); |
1055 | check_zone_namestore_next (); | ||
1056 | if (dht_queue_length >= DHT_QUEUE_LIMIT) | 1068 | if (dht_queue_length >= DHT_QUEUE_LIMIT) |
1057 | { | 1069 | { |
1058 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1070 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -1060,6 +1072,7 @@ put_gns_record (void *cls, | |||
1060 | DHT_QUEUE_LIMIT); | 1072 | DHT_QUEUE_LIMIT); |
1061 | return; | 1073 | return; |
1062 | } | 1074 | } |
1075 | check_zone_namestore_next (); | ||
1063 | 1076 | ||
1064 | ma = GNUNET_new (struct DhtPutActivity); | 1077 | ma = GNUNET_new (struct DhtPutActivity); |
1065 | perform_dht_put (key, | 1078 | perform_dht_put (key, |
@@ -1231,6 +1244,7 @@ handle_monitor_event (void *cls, | |||
1231 | return; | 1244 | return; |
1232 | } | 1245 | } |
1233 | ma = GNUNET_new (struct DhtPutActivity); | 1246 | ma = GNUNET_new (struct DhtPutActivity); |
1247 | ma->zm = zmon; | ||
1234 | perform_dht_put_monitor (zone, | 1248 | perform_dht_put_monitor (zone, |
1235 | label, | 1249 | label, |
1236 | rd, | 1250 | rd, |