Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
borngraced committed Oct 10, 2024
1 parent 17b1e31 commit 974907e
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions pairing_api/src/pairing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,12 @@ impl PairingClient {
}
}

/// Deletes a pairing from the store and subscribe from topic.
/// Deletes a pairing from the store and unsubscribe from topic.
/// This should be done only after completing all necessary actions,
/// such as handling responses and requests, since the pairing's sym_key
/// is required for encoding outgoing messages and decoding incoming ones.
pub async fn delete(&self, topic: &str, client: &Client) -> Result<(), PairingClientError> {
{
client
.unsubscribe(topic.into())
.await
.map_err(PairingClientError::SubscriptionError)?;
};

let mut pairings = self.pairings.lock().await;
pairings.remove(topic);

Ok(())
pub async fn delete(&self, topic: &str) {
self.pairings.lock().await.remove(topic);
}

/// Used to evaluate if peer is currently online. Timeout at 30 seconds
Expand Down

0 comments on commit 974907e

Please sign in to comment.