Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion keep-nip46/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,13 @@ impl Nip46Client {

match tokio::time::timeout(DEFAULT_REQUEST_TIMEOUT, setup).await {
Ok(Ok(())) => {}
Ok(Err(e)) => return Err(e),
Ok(Err(e)) => {
// Disconnect before propagating so the relay connections and the
// nostr-sdk background tasks they spawn are torn down instead of
// leaking (Drop does not disconnect), matching the timeout arm.
client.disconnect().await;
return Err(e);
}
Err(_) => {
client.disconnect().await;
return Err(NetworkError::timeout(
Expand Down