From 588066f415e956fdcd2c6f6216c52b25911a3b1d Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 27 Jan 2019 15:43:32 +0000 Subject: Add Manager struct to manage Nitrokey connections As part of the connection refactoring, we introduce the Manager struct that deals with connection management. To make sure there can be only once instance of the manager, we add a global static Mutex that holds the single Manager instance. We use the struct to ensure that the user can only connect to one device at a time. This also changes the Error::PoisonError variant to store the sync::PoisonError. This allows the user to call into_inner on the PoisonError to retrieve the MutexGuard and to ignore the error (for example useful during testing). --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index d26bd88..7daadd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ license = "MIT" exclude = [".builds/*"] [dependencies] +lazy_static = "1.2.0" libc = "0.2" nitrokey-sys = "3.5" rand_core = {version = "0.3", default-features = false, features = ["std"] } -- cgit v1.2.1 From a28b87a98a74687fb310e292b345ef540611fd21 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 31 Jan 2019 12:27:14 +0000 Subject: Update nitrokey-test to development version To test the changes to connection handling, we temporarily use the development version of nitrokey-test. --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index 7daadd1..e55f878 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,5 +24,5 @@ rand_core = {version = "0.3", default-features = false, features = ["std"] } rand_os = {version = "0.1"} [dev-dependencies] -nitrokey-test = {version = "0.2.1"} -nitrokey-test-state = {version = "0.1.0"} +nitrokey-test = {git = "https://github.com/robinkrahl/nitrokey-test", rev = "fdbe036720cf73dbb989e3a25611fa5cca4a513e"} +nitrokey-test-state = "0.1.0" -- cgit v1.2.1