From a2c12ab13efd621f917c2bfb7098cf2fad1bd4bc Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 22 Nov 2017 11:47:15 +0300 Subject: [PATCH] SecretStore: fixed warnings --- .../admin_sessions/share_add_session.rs | 11 ----------- .../client_sessions/encryption_session.rs | 5 ----- secret_store/src/key_server_cluster/cluster.rs | 5 ----- .../src/key_server_cluster/cluster_sessions.rs | 10 +++++----- .../src/listener/service_contract_listener.rs | 8 +++++--- 5 files changed, 10 insertions(+), 29 deletions(-) diff --git a/secret_store/src/key_server_cluster/admin_sessions/share_add_session.rs b/secret_store/src/key_server_cluster/admin_sessions/share_add_session.rs index 5fcc18a28..3156d6f87 100644 --- a/secret_store/src/key_server_cluster/admin_sessions/share_add_session.rs +++ b/secret_store/src/key_server_cluster/admin_sessions/share_add_session.rs @@ -179,17 +179,6 @@ impl SessionImpl where T: SessionTransport { }) } - /// Wait for session completion. - pub fn wait(&self) -> Result<(), Error> { - let mut data = self.data.lock(); - if !data.result.is_some() { - self.core.completed.wait(&mut data); - } - - data.result.clone() - .expect("checked above or waited for completed; completed is only signaled when result.is_some(); qed") - } - /// Set pre-established consensus data. pub fn set_consensus_output(&self, version: &H256, consensus_group: BTreeSet, mut new_nodes_map: BTreeMap>) -> Result<(), Error> { let mut data = self.data.lock(); diff --git a/secret_store/src/key_server_cluster/client_sessions/encryption_session.rs b/secret_store/src/key_server_cluster/client_sessions/encryption_session.rs index 83abbde86..1cc6ad9f3 100644 --- a/secret_store/src/key_server_cluster/client_sessions/encryption_session.rs +++ b/secret_store/src/key_server_cluster/client_sessions/encryption_session.rs @@ -130,11 +130,6 @@ impl SessionImpl { &self.self_node_id } - /// Get session state. - pub fn state(&self) -> SessionState { - self.data.lock().state.clone() - } - /// Wait for session completion. pub fn wait(&self, timeout: Option) -> Result<(), Error> { let mut data = self.data.lock(); diff --git a/secret_store/src/key_server_cluster/cluster.rs b/secret_store/src/key_server_cluster/cluster.rs index 5fbf47acc..c8f24034a 100644 --- a/secret_store/src/key_server_cluster/cluster.rs +++ b/secret_store/src/key_server_cluster/cluster.rs @@ -741,11 +741,6 @@ impl ClusterData { self.connections.get(node) } - /// Get sessions reference. - pub fn sessions(&self) -> &ClusterSessions { - &self.sessions - } - /// Spawns a future using thread pool and schedules execution of it with event loop handle. pub fn spawn(&self, f: F) where F: Future + Send + 'static, F::Item: Send + 'static, F::Error: Send + 'static { let pool_work = self.pool.spawn(f); diff --git a/secret_store/src/key_server_cluster/cluster_sessions.rs b/secret_store/src/key_server_cluster/cluster_sessions.rs index 2c1081c3b..2e83c407d 100644 --- a/secret_store/src/key_server_cluster/cluster_sessions.rs +++ b/secret_store/src/key_server_cluster/cluster_sessions.rs @@ -20,18 +20,18 @@ use std::sync::atomic::AtomicBool; use std::collections::{VecDeque, BTreeMap}; use parking_lot::{Mutex, RwLock}; use bigint::hash::H256; -use ethkey::{Public, Secret, Signature}; -use key_server_cluster::{Error, NodeId, SessionId, EncryptedDocumentKeyShadow}; +use ethkey::{Secret, Signature}; +use key_server_cluster::{Error, NodeId, SessionId}; use key_server_cluster::cluster::{Cluster, ClusterData, ClusterConfiguration, ClusterView}; use key_server_cluster::message::{self, Message}; -use key_server_cluster::generation_session::{SessionImpl as GenerationSessionImpl, SessionState as GenerationSessionState}; +use key_server_cluster::generation_session::{SessionImpl as GenerationSessionImpl}; use key_server_cluster::decryption_session::{SessionImpl as DecryptionSessionImpl}; -use key_server_cluster::encryption_session::{SessionImpl as EncryptionSessionImpl, SessionState as EncryptionSessionState}; +use key_server_cluster::encryption_session::{SessionImpl as EncryptionSessionImpl}; use key_server_cluster::signing_session::{SessionImpl as SigningSessionImpl}; use key_server_cluster::share_add_session::{SessionImpl as ShareAddSessionImpl, IsolatedSessionTransport as ShareAddTransport}; use key_server_cluster::servers_set_change_session::{SessionImpl as ServersSetChangeSessionImpl}; use key_server_cluster::key_version_negotiation_session::{SessionImpl as KeyVersionNegotiationSessionImpl, - IsolatedSessionTransport as VersionNegotiationTransport, ContinueAction}; + IsolatedSessionTransport as VersionNegotiationTransport}; use key_server_cluster::cluster_sessions_creator::{GenerationSessionCreator, EncryptionSessionCreator, DecryptionSessionCreator, SigningSessionCreator, KeyVersionNegotiationSessionCreator, AdminSessionCreator, SessionCreatorCore, ClusterSessionCreator}; diff --git a/secret_store/src/listener/service_contract_listener.rs b/secret_store/src/listener/service_contract_listener.rs index 33fde4eed..d77cc8135 100644 --- a/secret_store/src/listener/service_contract_listener.rs +++ b/secret_store/src/listener/service_contract_listener.rs @@ -351,8 +351,8 @@ impl ServiceContractListener { } /// Restore server key. - fn restore_server_key(data: &Arc, server_key_id: &ServerKeyId) -> Result { - unimplemented!() + fn restore_server_key(_data: &Arc, _server_key_id: &ServerKeyId) -> Result { + unimplemented!() // TODO } /// Publish server key. @@ -433,7 +433,9 @@ impl ClusterSessionsListener for ServiceContractListener { if !is_processed_by_this_key_server(&*self.data.params.key_servers_set, &*self.data.params.self_key_pair, &session.id()) { // by this time sesion must already be completed - either successfully, or not debug_assert!(session.is_finished()); - session.wait(Some(Default::default())) + + // ignore result - the only thing that we can do is to log the error + let _ = session.wait(Some(Default::default())) .map_err(|e| format!("{}", e)) .and_then(|server_key| Self::publish_server_key(&self.data, &session.id(), &server_key)) .map(|_| {