diff --git a/bin/dunitrust-server/src/main.rs b/bin/dunitrust-server/src/main.rs
index 5fac4425be35b41786f4ec9b83e0a67e0ee91fe9..00c91cef8a93a6e4a4c78121a0fd2d3f61ed0b22 100644
--- a/bin/dunitrust-server/src/main.rs
+++ b/bin/dunitrust-server/src/main.rs
@@ -63,7 +63,7 @@ macro_rules! durs_cli_main {
#[cfg(not(target_arch = "arm"))]
fn main() {
durs_cli_main!(durs_plug!(
- [WS2PModule],
+ [WS2Pv1Module, WS2PModule],
[TuiModule, GvaModule /*, SkeletonModule ,DasaModule*/]
))
}
diff --git a/lib/modules/gva/src/context.rs b/lib/modules/gva/src/context.rs
index 5b96d091c3e986b021f17a45a08943e5d9fc8bd1..29955f759cc604acec7fc24ce7c8fbd28c86aa55 100644
--- a/lib/modules/gva/src/context.rs
+++ b/lib/modules/gva/src/context.rs
@@ -36,14 +36,18 @@ impl Context {
}
}
-pub unsafe fn init(db: BcDbRo) {
- CONTEXT.replace(Context::new(db));
+pub fn init(db: BcDbRo) {
+ unsafe {
+ CONTEXT.replace(Context::new(db));
+ }
}
-pub unsafe fn get_context() -> &'static Context {
- if let Some(ref context) = CONTEXT {
- context
- } else {
- fatal_error!("GVA: no context");
+pub fn get_context() -> &'static Context {
+ unsafe {
+ if let Some(ref context) = CONTEXT {
+ context
+ } else {
+ fatal_error!("GVA: no context");
+ }
}
}
diff --git a/lib/modules/gva/src/lib.rs b/lib/modules/gva/src/lib.rs
index 9d0fe4ec757fb9c9956b1b6ad5f072000890df95..5798b72e630cf554403ea99738a4d82d2e371480 100644
--- a/lib/modules/gva/src/lib.rs
+++ b/lib/modules/gva/src/lib.rs
@@ -13,8 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-/// Gva Module
+//! Gva Module
#![deny(
missing_docs,
@@ -54,7 +53,7 @@ use std::sync::mpsc;
use std::thread;
use std::time::{Duration, SystemTime};
-pub static MODULE_NAME: &str = "gva";
+static MODULE_NAME: &str = "gva";
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
/// Gva Module Configuration
@@ -176,7 +175,7 @@ impl DursModule<DuRsConf, DursMsg> for GvaModule {
Some(new_gva_conf)
}
fn start(
- _soft_meta_datas: &SoftwareMetaDatas<DuRsConf>,
+ soft_meta_datas: &SoftwareMetaDatas<DuRsConf>,
_keys: RequiredKeysContent,
_conf: Self::ModuleConf,
router_sender: mpsc::Sender<RouterThreadMessage<DursMsg>>,
@@ -247,7 +246,7 @@ impl DursModule<DuRsConf, DursMsg> for GvaModule {
}
});
- let smd: SoftwareMetaDatas<DuRsConf> = _soft_meta_datas.clone();
+ let smd: SoftwareMetaDatas<DuRsConf> = soft_meta_datas.clone();
thread::spawn(move || {
let _ = webserver::start_web_server(&smd);
});
diff --git a/lib/modules/gva/src/schema.rs b/lib/modules/gva/src/schema.rs
index d1ac802bd39fe39bc69643206539d3b885987a50..22165dcfe47dcd91a57c3f7cc6fe54337a3bca6a 100644
--- a/lib/modules/gva/src/schema.rs
+++ b/lib/modules/gva/src/schema.rs
@@ -13,7 +13,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
use crate::context::Context;
use dubp_block_doc::block::BlockDocumentTrait;
use dubp_common_doc::traits::Document;
diff --git a/lib/modules/gva/src/webserver.rs b/lib/modules/gva/src/webserver.rs
index 327c8b9ee3a39d26eb60c5de5960b1cce69eab87..81f84b1bf7c4300952f68587bf941773a39ee000 100644
--- a/lib/modules/gva/src/webserver.rs
+++ b/lib/modules/gva/src/webserver.rs
@@ -13,7 +13,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
use crate::context;
use crate::schema::*;
use actix_web::{middleware, web, App, Error, HttpResponse, HttpServer};
@@ -38,7 +37,7 @@ fn graphql(
st: web::Data<Arc<Schema>>,
data: web::Json<GraphQLRequest>,
) -> impl Future<Item = HttpResponse, Error = Error> {
- let context = unsafe { crate::context::get_context() };
+ let context = crate::context::get_context();
web::block(move || {
let res = data.execute(&st, context);
Ok::<_, serde_json::error::Error>(serde_json::to_string(&res)?)
@@ -61,9 +60,7 @@ pub fn start_web_server(_soft_meta_datas: &SoftwareMetaDatas<DuRsConf>) -> std::
// Instanciate the context
let db_path = durs_conf::get_blockchain_db_path(_soft_meta_datas.profile_path.clone());
if let Ok(db) = durs_bc_db_reader::open_db_ro(&std::path::Path::new(&db_path)) {
- unsafe {
- context::init(db);
- }
+ context::init(db);
} else {
fatal_error!("GVA: fail to open DB.");
};
diff --git a/lib/modules/ws2p-v1-legacy/src/lib.rs b/lib/modules/ws2p-v1-legacy/src/lib.rs
index 055465eb8851dde994f2f56c08caaf95942c615e..3da15c0836cbad3a9c9227e133dcfe633bb8a2ed 100644
--- a/lib/modules/ws2p-v1-legacy/src/lib.rs
+++ b/lib/modules/ws2p-v1-legacy/src/lib.rs
@@ -505,6 +505,8 @@ impl DursModule<DuRsConf, DursMsg> for WS2Pv1Module {
// Get start time
let start_time = SystemTime::now();
+ info!("Start WS2P1 Module.");
+
// Get key_pair
let key_pair = if let RequiredKeysContent::NetworkKeyPair(key_pair) = keys {
key_pair