File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
consensus-albatross/src/sync Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -413,9 +413,12 @@ impl<TNetwork: Network> Stream for HistorySync<TNetwork> {
413
413
}
414
414
415
415
// Stop pulling in new EpochIds if we hit a maximum a number of clusters to prevent DoS.
416
- if self . sync_clusters . len ( ) < Self :: MAX_CLUSTERS {
417
- // FIXME: move check into loop!
418
- while let Poll :: Ready ( Some ( epoch_ids) ) = self . epoch_ids_stream . poll_next_unpin ( cx) {
416
+ loop {
417
+ if self . sync_clusters . len ( ) >= Self :: MAX_CLUSTERS {
418
+ break ;
419
+ }
420
+
421
+ if let Poll :: Ready ( Some ( epoch_ids) ) = self . epoch_ids_stream . poll_next_unpin ( cx) {
419
422
if let Some ( epoch_ids) = epoch_ids {
420
423
// The peer might have disconnected during the request.
421
424
// FIXME Check if the peer is still connected
@@ -429,6 +432,8 @@ impl<TNetwork: Network> Stream for HistorySync<TNetwork> {
429
432
}
430
433
self . cluster_epoch_ids ( epoch_ids) ;
431
434
}
435
+ } else {
436
+ break ;
432
437
}
433
438
}
434
439
You can’t perform that action at this time.
0 commit comments