Skip to content

Commit

Permalink
feat: ns key in map as Str (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Totodore authored Jun 26, 2024
1 parent 8aa3f51 commit e8a85e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-interior-mutability = ["bytes::Bytes", "engineioxide::Str"]
2 changes: 2 additions & 0 deletions socketioxide/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ impl<A: Adapter> Client<A> {
if let Some(ns) = self.get_ns(&ns_path) {
tokio::spawn(connect(ns, esocket.clone()));
} else if let Ok(Match { value: ns_ctr, .. }) = self.router.read().unwrap().at(&ns_path) {
// We have to create a new `Str` otherwise, we would keep a ref to the original connect packet
// for the entire lifetime of the Namespace.
let path = Str::copy_from_slice(&ns_path);
let ns = ns_ctr.get_new_ns(path.clone());
self.nsps.write().unwrap().insert(path, ns.clone());
Expand Down

0 comments on commit e8a85e0

Please sign in to comment.