mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-14 06:59:07 -05:00
fix: prevent loop when nip05 metadata channel closes
This commit is contained in:
parent
28b7b83a6e
commit
e63d179424
|
@ -62,6 +62,8 @@ pub enum Error {
|
||||||
HexError(hex::FromHexError),
|
HexError(hex::FromHexError),
|
||||||
#[error("Delegation parse error")]
|
#[error("Delegation parse error")]
|
||||||
DelegationParseError,
|
DelegationParseError,
|
||||||
|
#[error("Channel closed error")]
|
||||||
|
ChannelClosed,
|
||||||
#[error("Unknown/Undocumented")]
|
#[error("Unknown/Undocumented")]
|
||||||
UnknownError,
|
UnknownError,
|
||||||
}
|
}
|
||||||
|
|
10
src/nip05.rs
10
src/nip05.rs
|
@ -257,8 +257,15 @@ impl Verifier {
|
||||||
// run a loop, restarting on failure
|
// run a loop, restarting on failure
|
||||||
loop {
|
loop {
|
||||||
let res = self.run_internal().await;
|
let res = self.run_internal().await;
|
||||||
if let Err(e) = res {
|
match res {
|
||||||
|
Err(Error::ChannelClosed) => {
|
||||||
|
// channel was closed, we are shutting down
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
info!("error in verifier: {:?}", e);
|
info!("error in verifier: {:?}", e);
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,6 +312,7 @@ impl Verifier {
|
||||||
}
|
}
|
||||||
Err(tokio::sync::broadcast::error::RecvError::Closed) => {
|
Err(tokio::sync::broadcast::error::RecvError::Closed) => {
|
||||||
info!("metadata broadcast channel closed");
|
info!("metadata broadcast channel closed");
|
||||||
|
return Err(Error::ChannelClosed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user