Skip to content
Snippets Groups Projects
Commit b185a087 authored by Éloïs's avatar Éloïs Committed by Éloïs
Browse files

[ref] print panic! in logs

parent 61512545
No related branches found
No related tags found
1 merge request!72Logs panic
...@@ -220,6 +220,7 @@ dependencies = [ ...@@ -220,6 +220,7 @@ dependencies = [
"duniter-network 0.1.0-a0.1", "duniter-network 0.1.0-a0.1",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
...@@ -512,6 +513,14 @@ dependencies = [ ...@@ -512,6 +513,14 @@ dependencies = [
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "log-panics"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "matches" name = "matches"
version = "0.1.6" version = "0.1.6"
...@@ -1145,6 +1154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -1145,6 +1154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16" "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16"
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" "checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
"checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac" "checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac"
"checksum log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
......
...@@ -18,6 +18,7 @@ duniter-module = { path = "../module" } ...@@ -18,6 +18,7 @@ duniter-module = { path = "../module" }
duniter-network = { path = "../network" } duniter-network = { path = "../network" }
lazy_static = "1.0.*" lazy_static = "1.0.*"
log = "0.4.*" log = "0.4.*"
log-panics = "2.0.*"
rand = "0.4.*" rand = "0.4.*"
regex = "1.0.*" regex = "1.0.*"
rust-crypto = "0.2.*" rust-crypto = "0.2.*"
......
...@@ -34,6 +34,7 @@ extern crate duniter_crypto; ...@@ -34,6 +34,7 @@ extern crate duniter_crypto;
extern crate duniter_message; extern crate duniter_message;
extern crate duniter_module; extern crate duniter_module;
extern crate duniter_network; extern crate duniter_network;
extern crate log_panics;
extern crate serde_json; extern crate serde_json;
extern crate simplelog; extern crate simplelog;
extern crate sqlite; extern crate sqlite;
...@@ -121,6 +122,9 @@ impl DuniterCore<DuRsConf> { ...@@ -121,6 +122,9 @@ impl DuniterCore<DuRsConf> {
// Init logger // Init logger
init_logger(profile.as_str(), soft_name, &cli_args); init_logger(profile.as_str(), soft_name, &cli_args);
// Print panic! in logs
log_panics::init();
// Load global conf // Load global conf
let (conf, keypairs) = duniter_conf::load_conf(profile.as_str()); let (conf, keypairs) = duniter_conf::load_conf(profile.as_str());
info!("Success to load global conf."); info!("Success to load global conf.");
......
...@@ -275,15 +275,10 @@ impl WS2PModuleDatas { ...@@ -275,15 +275,10 @@ impl WS2PModuleDatas {
.1 = WS2PConnectionState::Close .1 = WS2PConnectionState::Close
} }
} }
let _result = self if let Some(websocket) = self.websockets.get(&ws2p_full_id) {
.websockets let _result = websocket.0.close(ws::CloseCode::Normal);
.get(&ws2p_full_id) }
.expect("Try to close an unexistant websocket !") let _result = self.websockets.remove(ws2p_full_id);
.0
.close(ws::CloseCode::Normal);
self.websockets
.remove(ws2p_full_id)
.unwrap_or_else(|| panic!("Fatal error : no websocket for {} !", ws2p_full_id));
} }
pub fn ws2p_conn_message_pretreatment(&mut self, message: WS2PConnectionMessage) -> WS2PSignal { pub fn ws2p_conn_message_pretreatment(&mut self, message: WS2PConnectionMessage) -> WS2PSignal {
let ws2p_full_id = message.0; let ws2p_full_id = message.0;
......
...@@ -219,7 +219,10 @@ impl DuniterModule<DuRsConf, DuniterMessage> for WS2PModule { ...@@ -219,7 +219,10 @@ impl DuniterModule<DuRsConf, DuniterMessage> for WS2PModule {
rooter_sender: mpsc::Sender<RooterThreadMessage<DuniterMessage>>, rooter_sender: mpsc::Sender<RooterThreadMessage<DuniterMessage>>,
load_conf_only: bool, load_conf_only: bool,
) -> Result<(), ModuleInitError> { ) -> Result<(), ModuleInitError> {
// Get start time
let start_time = SystemTime::now(); let start_time = SystemTime::now();
// Define WS2PModuleDatas
let mut ws2p_module = WS2PModuleDatas { let mut ws2p_module = WS2PModuleDatas {
followers: Vec::new(), followers: Vec::new(),
key_pair: None, key_pair: None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment