Skip to content

Commit e8a85e0

Browse files
authored
feat: ns key in map as Str (#343)
1 parent 8aa3f51 commit e8a85e0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

clippy.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-interior-mutability = ["bytes::Bytes", "engineioxide::Str"]

socketioxide/src/client.rs

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ impl<A: Adapter> Client<A> {
7575
if let Some(ns) = self.get_ns(&ns_path) {
7676
tokio::spawn(connect(ns, esocket.clone()));
7777
} else if let Ok(Match { value: ns_ctr, .. }) = self.router.read().unwrap().at(&ns_path) {
78+
// We have to create a new `Str` otherwise, we would keep a ref to the original connect packet
79+
// for the entire lifetime of the Namespace.
7880
let path = Str::copy_from_slice(&ns_path);
7981
let ns = ns_ctr.get_new_ns(path.clone());
8082
self.nsps.write().unwrap().insert(path, ns.clone());

0 commit comments

Comments
 (0)