scatter_net/legacy/peer_group/implementations/
terminate.rs1use iroh::endpoint::VarInt;
2
3use crate::{Peer, PeerGroup, Terminate};
4
5impl<E, R> Terminate<E, R> for PeerGroup
6where
7 E: Into<VarInt> + Send,
8 R: AsRef<[u8]> + Send,
9{
10 fn terminate(&self, error_code: E, reason: &R) {
11 let error_code = error_code.into();
12 let reason = reason.as_ref();
13
14 let peers: Vec<Peer> = self.read().peers.values().cloned().collect();
15
16 for peer in peers {
17 peer.terminate(error_code, &reason);
18 }
19 }
20}