Fix 'dos' feature for seed command, and Buffer the seed service
@@ -131,14 +131,14 @@ impl SeedCmd {
info!("begin tower-based peer handling test stub");
let (addressbook_tx, addressbook_rx) = oneshot::channel();
- let mut seed_service = SeedService {
+ let seed_service = SeedService {
state: SeederState::AwaitingAddressBook(addressbook_rx),
};
- let node = Buffer::new(seed_service, 1);
+ let buffered_svc = Buffer::new(seed_service, 1);
let config = app_config().network.clone();
- let (mut peer_set, address_book) = zebra_network::init(config, node).await;
+ let (mut peer_set, address_book) = zebra_network::init(config, buffered_svc.clone()).await;
let _ = addressbook_tx.send(address_book);
@@ -154,11 +154,12 @@ impl SeedCmd {
// Fire GetPeers requests at ourselves, for testing.
tokio::spawn(async move {
let mut interval_stream = tokio::time::interval(Duration::from_secs(1));
+ let mut svc = buffered_svc.clone();
loop {
interval_stream.next().await;
- let _ = seed_service.call(Request::Peers);
+ let _ = svc.call(Request::Peers);
}
});
