Skip adding relays that are already in the pool
This commit is contained in:
@@ -152,6 +152,10 @@ impl RelayPool {
|
|||||||
url: String,
|
url: String,
|
||||||
wakeup: impl Fn() + Send + Sync + Clone + 'static,
|
wakeup: impl Fn() + Send + Sync + Clone + 'static,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
// Check if the URL already exists in the pool.
|
||||||
|
if self.has(&url) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let relay = Relay::new(url, wakeup)?;
|
let relay = Relay::new(url, wakeup)?;
|
||||||
let pool_relay = PoolRelay::new(relay);
|
let pool_relay = PoolRelay::new(relay);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user