From 23aed088f7e31d26ddcc6996a1fb355d9075e7cb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 2 Sep 2019 14:47:38 -0400 Subject: give sessions an id --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + src/cmd/server.rs | 3 +++ 3 files changed, 14 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 0fe7493..b7cf23b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -541,6 +541,7 @@ dependencies = [ "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "snafu 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -730,6 +731,14 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "uuid" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "vec_map" version = "0.8.1" @@ -856,6 +865,7 @@ dependencies = [ "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" diff --git a/Cargo.toml b/Cargo.toml index 6e1fbaf..d6777eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,4 @@ futures = "0.1" mio = "0.6" snafu = { version = "0.4", features = ["futures-01"] } tokio = "0.1" +uuid = { version = "0.7", features = ["v4"] } diff --git a/src/cmd/server.rs b/src/cmd/server.rs index af58aba..315b1f5 100644 --- a/src/cmd/server.rs +++ b/src/cmd/server.rs @@ -102,6 +102,7 @@ enum SockType { #[derive(Debug)] struct SocketMetadata { ty: SockType, + id: String, username: Option, saved_data: Vec, } @@ -118,6 +119,7 @@ impl Socket { s, meta: SocketMetadata { ty: SockType::Cast, + id: format!("{}", uuid::Uuid::new_v4()), username: None, saved_data: vec![], }, @@ -129,6 +131,7 @@ impl Socket { s, meta: SocketMetadata { ty: SockType::Watch, + id: format!("{}", uuid::Uuid::new_v4()), username: None, saved_data: vec![], }, -- cgit v1.2.3-54-g00ecf