forked from lx/netapp
Move things around and fix error bit
This commit is contained in:
parent
9cb28c21b4
commit
5da59ebec5
5 changed files with 9 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -29,7 +29,6 @@ pub mod netapp;
|
|||
pub mod peering;
|
||||
|
||||
pub use crate::netapp::*;
|
||||
pub use util::{NetworkKey, NodeID, NodeKey};
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue