From aab4f000b5c0940332ad9468765843039efa9c52 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Sat, 24 Oct 2020 22:59:14 +0200 Subject: [PATCH] Improve logging --- src/cloud.rs | 22 +++++++++++++++------- src/crypto/core.rs | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/cloud.rs b/src/cloud.rs index 35aa29a..053eede 100644 --- a/src/cloud.rs +++ b/src/cloud.rs @@ -353,7 +353,7 @@ impl GenericCloud GenericCloud { + self.pending_inits.insert(src, init); + Ok(res) + } + Err(err) => { + warn!("Error in init message from peer {}: {}", addr_nice(src), err); + return Ok(()) + } } - msg_result } else if let Some(peer) = self.peers.get_mut(&src) { peer.crypto.handle_message(data) } else { - error!("Received non-init message from unknown peer {}", addr_nice(src)); + info!("Ignoring non-init message from unknown peer {}", addr_nice(src)); return Ok(()) }; match msg_result { @@ -737,10 +743,12 @@ impl GenericCloud(key: &mut CryptoKey, nonce: Nonce, data_and_tag: &'a mut [u8]) -> Result<(), Error> { + fn decrypt_with_key(key: &mut CryptoKey, nonce: Nonce, data_and_tag: &mut [u8]) -> Result<(), Error> { if nonce < key.min_nonce { return Err(Error::Crypto("Old nonce rejected")) }