SecretStore: fixed warnings

This commit is contained in:
Svyatoslav Nikolsky 2017-11-22 11:47:15 +03:00
parent 85e150dbb5
commit a2c12ab13e
5 changed files with 10 additions and 29 deletions

View File

@ -179,17 +179,6 @@ impl<T> SessionImpl<T> 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. /// Set pre-established consensus data.
pub fn set_consensus_output(&self, version: &H256, consensus_group: BTreeSet<NodeId>, mut new_nodes_map: BTreeMap<NodeId, Option<Secret>>) -> Result<(), Error> { pub fn set_consensus_output(&self, version: &H256, consensus_group: BTreeSet<NodeId>, mut new_nodes_map: BTreeMap<NodeId, Option<Secret>>) -> Result<(), Error> {
let mut data = self.data.lock(); let mut data = self.data.lock();

View File

@ -130,11 +130,6 @@ impl SessionImpl {
&self.self_node_id &self.self_node_id
} }
/// Get session state.
pub fn state(&self) -> SessionState {
self.data.lock().state.clone()
}
/// Wait for session completion. /// Wait for session completion.
pub fn wait(&self, timeout: Option<time::Duration>) -> Result<(), Error> { pub fn wait(&self, timeout: Option<time::Duration>) -> Result<(), Error> {
let mut data = self.data.lock(); let mut data = self.data.lock();

View File

@ -741,11 +741,6 @@ impl ClusterData {
self.connections.get(node) 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. /// Spawns a future using thread pool and schedules execution of it with event loop handle.
pub fn spawn<F>(&self, f: F) where F: Future + Send + 'static, F::Item: Send + 'static, F::Error: Send + 'static { pub fn spawn<F>(&self, f: F) where F: Future + Send + 'static, F::Item: Send + 'static, F::Error: Send + 'static {
let pool_work = self.pool.spawn(f); let pool_work = self.pool.spawn(f);

View File

@ -20,18 +20,18 @@ use std::sync::atomic::AtomicBool;
use std::collections::{VecDeque, BTreeMap}; use std::collections::{VecDeque, BTreeMap};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use bigint::hash::H256; use bigint::hash::H256;
use ethkey::{Public, Secret, Signature}; use ethkey::{Secret, Signature};
use key_server_cluster::{Error, NodeId, SessionId, EncryptedDocumentKeyShadow}; use key_server_cluster::{Error, NodeId, SessionId};
use key_server_cluster::cluster::{Cluster, ClusterData, ClusterConfiguration, ClusterView}; use key_server_cluster::cluster::{Cluster, ClusterData, ClusterConfiguration, ClusterView};
use key_server_cluster::message::{self, Message}; 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::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::signing_session::{SessionImpl as SigningSessionImpl};
use key_server_cluster::share_add_session::{SessionImpl as ShareAddSessionImpl, IsolatedSessionTransport as ShareAddTransport}; 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::servers_set_change_session::{SessionImpl as ServersSetChangeSessionImpl};
use key_server_cluster::key_version_negotiation_session::{SessionImpl as KeyVersionNegotiationSessionImpl, 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, use key_server_cluster::cluster_sessions_creator::{GenerationSessionCreator, EncryptionSessionCreator, DecryptionSessionCreator, SigningSessionCreator,
KeyVersionNegotiationSessionCreator, AdminSessionCreator, SessionCreatorCore, ClusterSessionCreator}; KeyVersionNegotiationSessionCreator, AdminSessionCreator, SessionCreatorCore, ClusterSessionCreator};

View File

@ -351,8 +351,8 @@ impl ServiceContractListener {
} }
/// Restore server key. /// Restore server key.
fn restore_server_key(data: &Arc<ServiceContractListenerData>, server_key_id: &ServerKeyId) -> Result<Public, String> { fn restore_server_key(_data: &Arc<ServiceContractListenerData>, _server_key_id: &ServerKeyId) -> Result<Public, String> {
unimplemented!() unimplemented!() // TODO
} }
/// Publish server key. /// Publish server key.
@ -433,7 +433,9 @@ impl ClusterSessionsListener<GenerationSession> for ServiceContractListener {
if !is_processed_by_this_key_server(&*self.data.params.key_servers_set, &*self.data.params.self_key_pair, &session.id()) { 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 // by this time sesion must already be completed - either successfully, or not
debug_assert!(session.is_finished()); 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)) .map_err(|e| format!("{}", e))
.and_then(|server_key| Self::publish_server_key(&self.data, &session.id(), &server_key)) .and_then(|server_key| Self::publish_server_key(&self.data, &session.id(), &server_key))
.map(|_| { .map(|_| {