diff --git a/Cargo.lock b/Cargo.lock index f1501134d930f89b32b494bf3142f2556913bcd0..04f09355198212f3804b6129436a2f27880ce006 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1214,6 +1214,7 @@ dependencies = [ "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "ws 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1222,7 +1223,6 @@ name = "durs-ws2p-messages" version = "0.3.0-dev" dependencies = [ "bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dubp-block-doc 0.1.0", "dubp-common-doc 0.1.0", "dubp-currency-params 0.2.0", @@ -1235,7 +1235,6 @@ dependencies = [ "pkstl 0.1.0", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1261,6 +1260,7 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pkstl 0.1.0", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "unwrap 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2245,7 +2245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/lib/modules/ws2p/ws2p-protocol/src/websocket.rs b/lib/modules/ws2p/ws2p-protocol/src/websocket.rs index d61c56f9c4a82cb332c76215fd49fe6a12c02935..c15ade155204673ba128573c663e5f6dc316ca79 100644 --- a/lib/modules/ws2p/ws2p-protocol/src/websocket.rs +++ b/lib/modules/ws2p/ws2p-protocol/src/websocket.rs @@ -106,6 +106,7 @@ pub enum WsError { /// the websocket trait is an abstraction allowing to move the logic of websocket handling /// in the protocol crate +/// it has a listen and exec function (not sure if it should have a connect function) pub trait WebsocketTrait: Debug + Clone + Send { /// constructor fn new( @@ -129,16 +130,3 @@ pub trait WebsocketTrait: Debug + Clone + Send { /// Execute websocket action without precising success or failure states fn exec(&self, action: WebsocketAction) -> Result<(), WsError>; } - -// je n'ai pas bien compris la différence entre WebsocketAction et WebsocketActionOrder -// donc j'ai fait deux fonctions exec de manière temporaire pour transformer l'un en l'autre - -// fn exec_action(&self, action: WebsocketAction) -> Result<(), WsError> { -// /// transform Action into ActionOrder -// let action_order = WebsocketActionOrder { -// ws_action: action, -// new_state_if_success: None, -// new_state_if_fail: WS2PConnectionState::Close, -// }; -// self.exec(action_order) -// } diff --git a/lib/modules/ws2p/ws2p/src/websocket.rs b/lib/modules/ws2p/ws2p/src/websocket.rs index 77e135c2c957153656a88116b8c714f41bbf67ad..c43d6ff0c4ce7a62c03f7d5dd54034e4933b2012 100644 --- a/lib/modules/ws2p/ws2p/src/websocket.rs +++ b/lib/modules/ws2p/ws2p/src/websocket.rs @@ -33,6 +33,9 @@ use std::net::ToSocketAddrs; use std::sync::mpsc; #[derive(Debug, Clone)] +/// the WebsocketConnector is just a small structure containing minimal information +/// that will implement the WebsocketTrait +/// it will allow the ws2p-protocol crate to manage websocket-specific actions like opening connection... pub struct WebsocketConnector { my_self_ws2p_node: MySelfWs2pNode, orchestrator_sender: mpsc::Sender<OrchestratorMsg<DursMsg>>, diff --git a/lib/modules/ws2p/ws2p/tests/syncronisation.rs b/lib/modules/ws2p/ws2p/tests/syncronisation.rs index 48e1bc8a9aaa7b11031e3d67582c617a6a937247..6d9a2e5e92c0a011919cc4ee9f0339063180a6b4 100644 --- a/lib/modules/ws2p/ws2p/tests/syncronisation.rs +++ b/lib/modules/ws2p/ws2p/tests/syncronisation.rs @@ -78,7 +78,7 @@ fn keypair2() -> ed25519::Ed25519KeyPair { } // generate the blockchain data in the temporary directory -// FIXME now it's juste copying existing data +// FIXME (now it's just copying existing data) fn generate_blockchain_data(tmp_profile_path: &PathBuf, source_path: &str) { let source_path = PathBuf::from(source_path.clone()); let data_dir: PathBuf = [tmp_profile_path.clone(), PathBuf::from("datas")]