Skip adding relays that are already in the pool

This commit is contained in:
Ken Sedgwick
2024-10-17 20:26:12 -07:00
parent 26cb1a2c07
commit e166dc17ef

View File

@@ -152,6 +152,10 @@ impl RelayPool {
url: String,
wakeup: impl Fn() + Send + Sync + Clone + 'static,
) -> Result<()> {
// Check if the URL already exists in the pool.
if self.has(&url) {
return Ok(());
}
let relay = Relay::new(url, wakeup)?;
let pool_relay = PoolRelay::new(relay);