Move things around and fix error bit
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Alex 2022-07-22 13:06:10 +02:00
parent 9cb28c21b4
commit 5da59ebec5
Signed by: lx
GPG key ID: 0E496D15096376BE
5 changed files with 9 additions and 10 deletions

View file

@ -7,7 +7,6 @@ use async_trait::async_trait;
use crate::error::Error;
use crate::message::*;
use crate::netapp::*;
use crate::util::*;
/// This trait should be implemented by an object of your application
/// that can handle a message of type `M`, if it wishes to handle

View file

@ -29,7 +29,6 @@ pub mod netapp;
pub mod peering;
pub use crate::netapp::*;
pub use util::{NetworkKey, NodeID, NodeKey};
#[cfg(test)]
mod test;

View file

@ -22,7 +22,13 @@ use crate::endpoint::*;
use crate::error::*;
use crate::message::*;
use crate::server::*;
use crate::util::*;
/// A node's identifier, which is also its public cryptographic key
pub type NodeID = sodiumoxide::crypto::sign::ed25519::PublicKey;
/// A node's secret key
pub type NodeKey = sodiumoxide::crypto::sign::ed25519::SecretKey;
/// A network key
pub type NetworkKey = sodiumoxide::crypto::auth::Key;
/// Tag which is exchanged between client and server upon connection establishment
/// to check that they are running compatible versions of Netapp,

View file

@ -75,7 +75,7 @@ pub(crate) trait RecvLoop: Sync + 'static {
let has_cont = (size & CHUNK_HAS_CONTINUATION) != 0;
let is_error = (size & ERROR_MARKER) != 0;
let packet = if is_error {
Err(size as u8)
Err((size & !ERROR_MARKER) as u8)
} else {
let size = size & !CHUNK_HAS_CONTINUATION;
let mut next_slice = vec![0; size as usize];

View file

@ -6,12 +6,7 @@ use serde::Serialize;
use tokio::sync::watch;
/// A node's identifier, which is also its public cryptographic key
pub type NodeID = sodiumoxide::crypto::sign::ed25519::PublicKey;
/// A node's secret key
pub type NodeKey = sodiumoxide::crypto::sign::ed25519::SecretKey;
/// A network key
pub type NetworkKey = sodiumoxide::crypto::auth::Key;
use crate::netapp::*;
/// Utility function: encodes any serializable value in MessagePack binary format
/// using the RMP library.